supabase-keepalive and supabase-keep-alive were both already taken/blocked on npm (an unrelated package and npm's publish-time name-similarity filter), so this ships on the registry as supabase-stay-awake instead. Adds the one-command scheduled-ping setup the CLI was missing: `setup` copies itself to ~/.supabase-stay-awake/ping.js and installs a daily user crontab line (zero signup to us, no GitHub); `list`/`uninstall` manage it; falls back to printing the line (never hangs) if crontab can't be written. Also points every README/CLI example at the published package instead of the npx --yes git+... form, and fixes the stale git.ereboslab.com links to rithub.dev (the domain itself already 301s there). Published and verified live: npm install in a clean dir, help/setup/list/ uninstall/one-off-ping all run correctly against the real registry. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
35 lines
1.3 KiB
Bash
Executable File
35 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Keep-alive from any machine with cron: a VPS, a Raspberry Pi, a NAS. No GitHub involved,
|
|
# so GitHub's "schedules stop after 60 days without a push" rule cannot bite.
|
|
#
|
|
# One-time setup:
|
|
# mkdir -p ~/supabase-keep-alive && cd ~/supabase-keep-alive
|
|
# curl -fsSL -O https://rithub.dev/caelum0x/supabase-keep-alive-action/raw/tag/v1/keepalive.sh
|
|
# curl -fsSL -O https://rithub.dev/caelum0x/supabase-keep-alive-action/raw/tag/v1/examples/cron.sh
|
|
# chmod 700 cron.sh
|
|
# printf 'SUPABASE_URL=https://YOUR-REF.supabase.co\nSUPABASE_ANON_KEY=YOUR-ANON-KEY\n' > .env
|
|
# chmod 600 .env
|
|
#
|
|
# Then add one line with `crontab -e` (daily at 06:17):
|
|
# 17 6 * * * $HOME/supabase-keep-alive/cron.sh >> $HOME/supabase-keep-alive/keepalive.log 2>&1
|
|
#
|
|
# Exit code 0 = project awake, 1 = paused (HTTP 540) or failed; the log says which.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
if [[ ! -f .env ]]; then
|
|
echo "missing .env next to cron.sh (SUPABASE_URL and SUPABASE_ANON_KEY)" >&2
|
|
exit 1
|
|
fi
|
|
set -a
|
|
# shellcheck disable=SC1091
|
|
. ./.env
|
|
set +a
|
|
|
|
echo "--- $(date -u +'%Y-%m-%d %H:%M:%S UTC')"
|
|
INPUT_URL="${SUPABASE_URL:?SUPABASE_URL is not set in .env}" \
|
|
INPUT_ANON_KEY="${SUPABASE_ANON_KEY:?SUPABASE_ANON_KEY is not set in .env}" \
|
|
INPUT_TABLE="${KEEPALIVE_TABLE:-keepalive}" \
|
|
INPUT_RPC="${KEEPALIVE_RPC:-}" \
|
|
bash ./keepalive.sh
|