-
Notifications
You must be signed in to change notification settings - Fork 238
Running FediFetcher as a systemd timer
If you prefer running FediFetcher from a systemd timer you can follow these steps:
-
Navigate to the directory
/opt
:cd /opt
-
Clone the FediFetcher repository from GitHub:
git clone https://github.com/nanos/FediFetcher.git
-
Create a Python Virtual Environment named
fedifetcher
:python3 -m venv fedifetcher
-
Change to the FediFetcher directory:
cd FediFetcher
-
Activate the virtual environment:
source /opt/fedifetcher/bin/activate
-
Install the required Python packages from the
requirements.txt
file:pip install -r requirements.txt
-
Deactivate the virtual environment:
deactivate
-
Configure FediFetcher according to the instructions provided at: Configuration Options.
-
Run FediFetcher for the first time:
/opt/fedifetcher/bin/python3 find_posts.py -c=artifacts/config.json
-
Create a systemd service file for FediFetcher:
nano /etc/systemd/system/fedifetcher.service
Paste the following content (replace
User=mastodon
with another user, if needed):[Unit] Description=FediFetcher Service After=network.target [Service] Type=simple User=mastodon WorkingDirectory=/opt/FediFetcher ExecStart=/opt/fedifetcher/bin/python find_posts.py -c=artifacts/config.json [Install] WantedBy=multi-user.target
-
Create a systemd timer file for FediFetcher.
nano /etc/systemd/system/fedifetcher.timer
Paste the following content:
[Unit] Description=FediFetcher Timer [Timer] OnCalendar=*-*-* *:*:00 Persistent=true [Install] WantedBy=timers.target
Explanation:
-
OnCalendar
: This option defines when the timer should elapse. The format isYYYY-MM-DD HH:MM:SS
.*-*-* *:00:00
means every hour,*-*-* *:*:00
means at the start of every minute. So, the timer will trigger every minute. More informations. -
Persistent=true
: This option ensures that if the system is unable to trigger the timer at the specified time (e.g., if the system is asleep or powered off), it will run the missed events when the system is next awake or powered on. -
WantedBy=timers.target
: This specifies that the timer should be enabled when thetimers.target
is active, which is usually during system startup.
-
-
Reload the systemd daemon configuration:
systemctl daemon-reload
-
Start the FediFetcher timer and enable it to start at every system boot:
systemctl start --now fedifetcher.timer
With these steps, FediFetcher should be successfully set up on your system and automatically started to fetch posts regularly.
It's important to stay up to with FediFetcher so you always get the latest features and bugfixes.
Please refer to the Updating FediFetcher documentation for more information.
Fork it and send a pull request. Read Contributing to FediFetcher for more info.