Add lock files and cron setup

This commit is contained in:
Jordan Wages 2025-07-19 03:35:18 -05:00
commit 2b38de598f
5 changed files with 79 additions and 1 deletions

View file

@ -1,6 +1,17 @@
#!/usr/bin/env bash
set -e
# Prevent multiple simultaneous runs by using a lock file specific to this
# script. If the lock already exists, assume another instance is running and
# exit gracefully.
LOCK_FILE="/tmp/$(basename "$0").lock"
if [ -e "$LOCK_FILE" ]; then
echo "[WARN] $(basename "$0") is already running (lock file present)." >&2
exit 0
fi
touch "$LOCK_FILE"
trap 'rm -f "$LOCK_FILE"' EXIT
# Ensure virtual environment exists
if [ ! -d ".venv" ]; then
echo "[INFO] Creating virtual environment..."