fuzzyworld-tools / files / server / jobs / comments-ingest.sh
comments-ingest.sh
| 1 | #!/bin/bash |
| 2 | # Hourly: turn new mail in the comments mailbox (IMAP, or ~/Maildir/.comments) into blog comments (see server/comments.py). |
| 3 | # Quiet unless something happened or failed. |
| 4 | set -euo pipefail |
| 5 | mkdir -p "$HOME/fw/state/locks" |
| 6 | exec 9>"$HOME/fw/state/locks/job-comments-ingest.lock" |
| 7 | flock -n 9 || exit 0 |
| 8 | out=$(python3 "$HOME/fw/tools/server/comments.py" ingest 2>&1) || { echo "== $(date -u '+%F %T UTC') comments ingest failed"; echo "$out"; exit 1; } |
| 9 | [ -z "$out" ] || { echo "== $(date -u '+%F %T UTC') comments ingest"; echo "$out"; } |