fuzzyworld

fuzzyworld-tools / files / server / jobs / comments-ingest.sh

comments-ingest.sh

541 B · history · blame

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.
4set -euo pipefail
5mkdir -p "$HOME/fw/state/locks"
6exec 9>"$HOME/fw/state/locks/job-comments-ingest.lock"
7flock -n 9 || exit 0
8out=$(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"; }