Add lock files and cron setup
This commit is contained in:
parent
d33a3f162f
commit
2b38de598f
5 changed files with 79 additions and 1 deletions
|
@ -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..."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue