If the Mastodon post fails (e.g. instance temporarily down), systemd will retry up to 5 times at 15-minute intervals over a 12-hour window before triggering the OnFailure notification. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
26 lines
825 B
Desktop File
26 lines
825 B
Desktop File
# lives at ~/.config/systemd/user/saints.service
|
|
|
|
# User-level systemd service to run get_saint_of_the_day.py
|
|
# Configuration is via ~/.config/saints.env, no in-file path edits needed.
|
|
# Create that file with one line:
|
|
# REPO_PATH=/absolute/path/to/this/repo
|
|
# Then run:
|
|
# systemctl --user daemon-reload
|
|
[Unit]
|
|
Description=Run get_saint_of_the_day.py (profile stats updater)
|
|
OnFailure=notify-gitea-failure@%n.service
|
|
StartLimitBurst=5
|
|
StartLimitIntervalSec=43200
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
Restart=on-failure
|
|
RestartSec=900
|
|
EnvironmentFile=%h/.config/saints.env
|
|
ExecStartPre=/usr/bin/nm-online -q
|
|
ExecStartPre=/bin/bash -c 'for i in {1..600}; do getent hosts tildegit.org && exit 0; sleep 1; done; exit 1'
|
|
ExecStart=/bin/bash -lc 'cd ${REPO_PATH} && uv run get_saint_of_the_day.py --post'
|
|
|
|
[Install]
|
|
WantedBy=default.target
|