diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-04-23 21:01:56 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-04-23 21:01:56 -0600 |
commit | 1692a370b4f58fd3ad709605d0e502dcac2a5c07 (patch) | |
tree | 0207694e127bae508eb074a63751ca9f02d20afe /aux | |
parent | 44058923078d5eb5bcab9bf5a1e507de8c6f60a6 (diff) |
fuss with systemd timers
Diffstat (limited to 'aux')
-rwxr-xr-x | aux/maintenance | 15 | ||||
-rw-r--r-- | aux/www-maintenance@.service | 8 | ||||
-rw-r--r-- | aux/www-maintenance@daily.timer | 13 | ||||
-rw-r--r-- | aux/www-maintenance@houry.timer | 12 | ||||
-rw-r--r-- | aux/www-maintenance@weekly.timer | 11 | ||||
-rw-r--r-- | aux/www-refresh.service | 8 | ||||
-rw-r--r-- | aux/www-refresh.timer | 12 |
7 files changed, 59 insertions, 20 deletions
diff --git a/aux/maintenance b/aux/maintenance new file mode 100755 index 0000000..d529b49 --- /dev/null +++ b/aux/maintenance @@ -0,0 +1,15 @@ +#!/bin/sh +set -x + +case "$1" in + hourly) + rm -f -- .http-cache/'https%3A%2F%2F'*'%2Fapi%2Fv1%2Faccounts%2F'*'%2Fstatuses%3Fexclude_reblogs%3Dtrue%26tagged%3DDailyStandUp' + ;; + daily|weekly) + rm -rf -- .http-cache + ;; +esac + +make + +git -C .git-cache maintenance run --schedule="$1" diff --git a/aux/www-maintenance@.service b/aux/www-maintenance@.service new file mode 100644 index 0000000..b1b0c8b --- /dev/null +++ b/aux/www-maintenance@.service @@ -0,0 +1,8 @@ +[Unit] +Description=Website maintenance cron job + +[Service] +Type=oneshot +Environment=LANG=en_US.UTF-8 +WorkingDirectory=%h/www +ExecStart=%h/www/aux/maintenance %i diff --git a/aux/www-maintenance@daily.timer b/aux/www-maintenance@daily.timer new file mode 100644 index 0000000..ea2ee73 --- /dev/null +++ b/aux/www-maintenance@daily.timer @@ -0,0 +1,13 @@ +[Unit] +Description=Website maintenance daily cron job + +[Timer] +Persistent=true +# Run every day somewhere between 4am and 5am MDT (in the summer; +# between 3am and 4am MST in the winter), except for on Sunday, when +# the @weekly timer runs instead. +OnCalendar=Mon..Sat *-*-* 10:00:00 UTC +RandomizedDelaySec=1h + +[Install] +WantedBy=default.target diff --git a/aux/www-maintenance@houry.timer b/aux/www-maintenance@houry.timer new file mode 100644 index 0000000..dd29194 --- /dev/null +++ b/aux/www-maintenance@houry.timer @@ -0,0 +1,12 @@ +[Unit] +Description=Website maintenance hourly cron job + +[Timer] +Persistent=true +# Run every hour, except for 10am UTC (see the @daily timer), when the +# @daily timer runs instead. +OnCalendar=*-*-* 0..9,11..23:00:00 UTC +RandomizedDelaySec=1h + +[Install] +WantedBy=default.target diff --git a/aux/www-maintenance@weekly.timer b/aux/www-maintenance@weekly.timer new file mode 100644 index 0000000..f5566e4 --- /dev/null +++ b/aux/www-maintenance@weekly.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Website maintenance weekly cron job + +[Timer] +Persistent=true +# Run every Sunday at 10am UTC (see the @daily timer). +OnCalendar=Sun 10:00:00 UTC +RandomizedDelaySec=1h + +[Install] +WantedBy=default.target diff --git a/aux/www-refresh.service b/aux/www-refresh.service deleted file mode 100644 index d6ecde1..0000000 --- a/aux/www-refresh.service +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Website update cron job - -[Service] -Type=oneshot -Environment=LANG=en_US.UTF-8 -WorkingDirectory=%h/www -ExecStart=sh -c 'rm -rf .http-cache && make && git -C .git-cache maintenance run' diff --git a/aux/www-refresh.timer b/aux/www-refresh.timer deleted file mode 100644 index d507e2f..0000000 --- a/aux/www-refresh.timer +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Website update cron job - -[Timer] -Persistent=true -# somewhere between 4am and 5am MDT (in the summer; -# between 3am and 4am MST in the winter) -OnCalendar=*-*-* 10:00:00 UTC -RandomizedDelaySec=1h - -[Install] -WantedBy=default.target |