ohmyapi commited on
Commit
716b579
·
verified ·
1 Parent(s): 5abf60c

fix: use /tmp/crontabs for read-only root filesystem

Browse files
Files changed (1) hide show
  1. entrypoint.sh +5 -5
entrypoint.sh CHANGED
@@ -18,18 +18,18 @@ echo "[entrypoint] Starting up at $(date)"
18
  CLEANUP_CRON_SCHEDULE="${CLEANUP_CRON_SCHEDULE:-0 */6 * * *}"
19
  CLEANUP_STARTUP_DELAY="${CLEANUP_STARTUP_DELAY:-10}"
20
 
21
- mkdir -p /tmp/logs /etc/crontabs
22
 
23
- # Write crontab
24
- cat > /etc/crontabs/root << EOF
25
  # CLIProxyAPI invalid token cleanup
26
  ${CLEANUP_CRON_SCHEDULE} /app/cleanup_tokens.sh >> /tmp/logs/cleanup.log 2>&1
27
  EOF
28
 
29
  echo "[entrypoint] Cleanup schedule: ${CLEANUP_CRON_SCHEDULE}"
30
 
31
- # Start crond (busybox)
32
- crond -l 8 -L /tmp/logs/crond.log
33
  echo "[entrypoint] crond started"
34
 
35
  # Wait for the API to be ready, then run the initial cleanup in background.
 
18
  CLEANUP_CRON_SCHEDULE="${CLEANUP_CRON_SCHEDULE:-0 */6 * * *}"
19
  CLEANUP_STARTUP_DELAY="${CLEANUP_STARTUP_DELAY:-10}"
20
 
21
+ mkdir -p /tmp/logs /tmp/crontabs
22
 
23
+ # Write crontab to /tmp (HuggingFace root filesystem is read-only)
24
+ cat > /tmp/crontabs/root << EOF
25
  # CLIProxyAPI invalid token cleanup
26
  ${CLEANUP_CRON_SCHEDULE} /app/cleanup_tokens.sh >> /tmp/logs/cleanup.log 2>&1
27
  EOF
28
 
29
  echo "[entrypoint] Cleanup schedule: ${CLEANUP_CRON_SCHEDULE}"
30
 
31
+ # Start crond (busybox) with custom crontab directory
32
+ crond -c /tmp/crontabs -l 8 -L /tmp/logs/crond.log
33
  echo "[entrypoint] crond started"
34
 
35
  # Wait for the API to be ready, then run the initial cleanup in background.