feat: empty CRON_SCHEDULE keeps container alive for manual docker exec

Three container lifetime modes via CRON_SCHEDULE:
  unset          — run once on startup, exit
  empty string   — sleep infinity; use docker exec -it winnow winnow
  cron expression — run on startup, then on schedule

This replaces the need for a separate MANUAL_MODE env var. The empty
string is a natural "I want the container alive but unscheduled" signal.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 15:01:00 +00:00
co-authored by Claude Sonnet 4.6
parent 2804b21f9e
commit 015db63d19
3 changed files with 28 additions and 9 deletions
+10 -3
View File
@@ -2,11 +2,19 @@
set -e
export PYTHONUNBUFFERED=1
# 1. Run the job immediately on startup
# CRON_SCHEDULE controls container lifetime:
# unset — run once and exit
# empty string — stay alive, run nothing (use: docker exec -it winnow winnow)
# cron expression — run immediately, then on schedule
if [ "${CRON_SCHEDULE+isset}" = "isset" ] && [ -z "$CRON_SCHEDULE" ]; then
echo "▶ CRON_SCHEDULE is empty — manual mode. Use 'docker exec -it winnow winnow' to run."
exec sleep infinity
fi
echo "▶ Running on startup..."
/app/.venv/bin/winnow
# 2. If a schedule exists, start the scheduler
if [ -n "${CRON_SCHEDULE:-}" ]; then
echo "▶ CRON_SCHEDULE set to: $CRON_SCHEDULE"
echo "▶ Switching to scheduled mode..."
@@ -14,4 +22,3 @@ if [ -n "${CRON_SCHEDULE:-}" ]; then
else
echo "▶ No schedule set, exiting."
fi