diff --git a/libguides-notifier/libguides-notifier.service b/libguides-notifier/libguides-notifier.service index d222912..4d7584c 100644 --- a/libguides-notifier/libguides-notifier.service +++ b/libguides-notifier/libguides-notifier.service @@ -1,14 +1,13 @@ -# lives at ~/.config/systemd/user/libguides-notifier.service - # User-level systemd service to run main.py # Uses a wrapper script so the working directory and .env are found correctly. # Configuration is via ~/.config/libguides-notifier.env, no in-file path edits needed. # Create that file with one line: -# REPO_PATH=/absolute/path/to/this/repo +# REPO_PATH=/absolute/path/to/project # Then run: # systemctl --user daemon-reload [Unit] Description=Run main.py (LibGuides notifier) +OnFailure=notify-gitea-failure@%n.service [Service] Type=oneshot diff --git a/notify/notify-gitea-failure@.service b/notify/notify-gitea-failure@.service new file mode 100644 index 0000000..d2bb5ba --- /dev/null +++ b/notify/notify-gitea-failure@.service @@ -0,0 +1,8 @@ +[Unit] +Description=Send Gitea failure notification for %i + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/notify-gitea.sh %i failure +# Load webhook URL from environment file +EnvironmentFile=-/etc/notify-gitea.conf diff --git a/notify/notify-gitea.sh b/notify/notify-gitea.sh index 12841f5..4e201e0 100755 --- a/notify/notify-gitea.sh +++ b/notify/notify-gitea.sh @@ -40,9 +40,9 @@ fi # Get recent logs for context (last 20 lines) # Try system journal first, fall back to user journal -RECENT_LOGS=$(journalctl -u "$SERVICE_NAME" -n 20 --no-pager 2>/dev/null) +RECENT_LOGS=$(journalctl -u "$SERVICE_NAME" -n 100 --no-pager 2>/dev/null) if [[ -z "$RECENT_LOGS" || "$RECENT_LOGS" == *"-- No entries --"* ]]; then - RECENT_LOGS=$(journalctl --user-unit "$SERVICE_NAME" -n 20 --no-pager 2>/dev/null || echo "No logs available") + RECENT_LOGS=$(journalctl --user-unit "$SERVICE_NAME" -n 100 --no-pager 2>/dev/null || echo "No logs available") fi # Build issue title and body diff --git a/notify/notify-teams-failure@.service b/notify/notify-teams-failure@.service deleted file mode 100644 index 74ce838..0000000 --- a/notify/notify-teams-failure@.service +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Send Teams failure notification for %i - -[Service] -Type=oneshot -ExecStart=/usr/local/bin/notify-teams.sh %i failure -# Load webhook URL from environment file -EnvironmentFile=-/etc/notify-teams.conf diff --git a/notify/notify-teams-success@.service b/notify/notify-teams-success@.service deleted file mode 100644 index 2e278be..0000000 --- a/notify/notify-teams-success@.service +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Send Teams success notification for %i - -[Service] -Type=oneshot -ExecStart=/usr/local/bin/notify-teams.sh %i success -# Load webhook URL from environment file -EnvironmentFile=-/etc/notify-teams.conf diff --git a/notify/notify-teams.conf.example b/notify/notify-teams.conf.example deleted file mode 100644 index 54efb3d..0000000 --- a/notify/notify-teams.conf.example +++ /dev/null @@ -1,3 +0,0 @@ -# /etc/notify-teams.conf -# Teams incoming webhook URL -TEAMS_WEBHOOK_URL="https://outlook.office.com/webhook/your-webhook-url-here" diff --git a/profile/profile-stats.service b/profile/profile-stats.service index 7302d76..3bb81c2 100644 --- a/profile/profile-stats.service +++ b/profile/profile-stats.service @@ -8,6 +8,7 @@ # systemctl --user daemon-reload [Unit] Description=Run update_profile.py (profile stats updater) +OnFailure=notify-gitea-failure@%n.service [Service] Type=oneshot diff --git a/renovate/renovate.service b/renovate/renovate.service index 6f3fe37..ee2f5be 100644 --- a/renovate/renovate.service +++ b/renovate/renovate.service @@ -1,5 +1,3 @@ -# lives at /etc/systemd/system/renovate.service - [Unit] Description=Renovate Bot After=network-online.target @@ -30,3 +28,7 @@ SyslogIdentifier=renovate [Install] WantedBy=multi-user.target + +[Unit] +Description=Renovate dependency updates +OnFailure=notify-gitea-failure@%n.service diff --git a/saints/saints.service b/saints/saints.service new file mode 100644 index 0000000..94dab77 --- /dev/null +++ b/saints/saints.service @@ -0,0 +1,21 @@ +# 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 + +[Service] +Type=oneshot +EnvironmentFile=%h/.config/saints.env +ExecStartPre=/usr/bin/nm-online -q +ExecStartPre=/bin/bash -c 'for i in {1..30}; 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 diff --git a/saints/saints.timer b/saints/saints.timer new file mode 100644 index 0000000..7c6ede9 --- /dev/null +++ b/saints/saints.timer @@ -0,0 +1,18 @@ +# lives at ~/.config/systemd/user/saints.timer + +# User-level systemd timer that "catches up" missed runs if the machine was off. +[Unit] +Description=Schedule get_saint_of_the_day.py with catch-up if missed + +[Timer] +# Change this to your desired schedule; examples: +# OnCalendar=daily +# OnCalendar=Mon..Fri 09:00 +# See man systemd.time for syntax. +OnCalendar=daily +Timezone=America/New_York +Persistent=true +Unit=saints.service + +[Install] +WantedBy=timers.target