summaryrefslogtreecommitdiff
path: root/git/install.sh
diff options
context:
space:
mode:
authoryyamashita <yyamashita@hetzner.yyamashita.com>2026-06-02 10:39:33 +0900
committeryyamashita <yyamashita@hetzner.yyamashita.com>2026-06-02 10:39:33 +0900
commit5e9ed4fe05eda672293dbfe6bf10da6d9635261b (patch)
treef436c0fbea111688b32bdf5a524a1a6e84eee31c /git/install.sh
parent462ce4169c4ce72a87bf4feb9174f81814f25999 (diff)
Add cron job registration to install.sh
Registers daily scrape (05:00 JST) and recap email (08:00 JST) jobs for tokyo-livehouse-events via idempotent crontab install. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'git/install.sh')
-rwxr-xr-xgit/install.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/git/install.sh b/git/install.sh
index d4522ea..54b9dda 100755
--- a/git/install.sh
+++ b/git/install.sh
@@ -72,4 +72,22 @@ for repo_src in "$HOOKS_SRC"/*/; do
done
echo ""
+echo "=== Cron jobs ==="
+CRON_JOBS=(
+ "0 5 * * * docker exec tokyo-app node -e \"fetch('http://localhost:3000/api/scrape').then(r=>r.text()).then(console.log)\""
+ "0 8 * * * docker exec tokyo-livehouse-events-scraper-1 node --import tsx/esm /app/scripts/send-recap.ts >> /var/log/recap.log 2>&1"
+)
+
+current_cron="$(crontab -l 2>/dev/null || true)"
+for job in "${CRON_JOBS[@]}"; do
+ if echo "$current_cron" | grep -qF "$job"; then
+ echo " exists: $job"
+ else
+ (echo "$current_cron"; echo "$job") | crontab -
+ current_cron="$(crontab -l)"
+ echo " added: $job"
+ fi
+done
+
+echo ""
echo "Done."