manage-client.cron 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Backup and update client — cron for installations that have it.
  2. #
  3. # Cron is OPTIONAL here. This host is assumed not to have it, so the backoffice
  4. # drives the schedule itself: any admin page load past the interval starts the
  5. # backup in the background (see app/manage.php). Everything below is the same
  6. # work on a dependable timer instead — set it up if the host offers cron, and
  7. # the web fallback simply never finds anything due.
  8. #
  9. # Two ways, pick one.
  10. MAILTO=admin@example.org
  11. # --- A. Over the web (no shell needed; works on hosts whose "cron" is really
  12. # --- just a URL fetcher). The key lives in data/worker-key.json.
  13. #
  14. # Runs whatever is due: the weekly backup, the hourly heartbeat. Never updates.
  15. */15 * * * * curl -s -m 10 "https://www.example.com/manage-worker.php?key=YOUR_WORKER_KEY" >/dev/null
  16. # --- B. Over the shell, with the CLI. Same jobs, explicit schedule.
  17. #
  18. # Check the PHP binary with `which php`; shared hosts often want a versioned
  19. # one such as /usr/bin/php8.2. --quiet suppresses normal output — errors still
  20. # go to STDERR, and cron mails those to MAILTO, which is the point.
  21. PHP=/usr/bin/php
  22. SITE=/var/www/html/foto-portfolio
  23. # Nightly backup at 03:20: data/ and media/, uploaded to the manage server.
  24. # Runs at night because it archives every locally hosted image.
  25. 20 3 * * * $PHP $SITE/manage-client/bin/manage-client.php backup --trigger=cron --quiet
  26. # Hourly status report: version, PHP version, free disk space, last backup.
  27. 7 * * * * $PHP $SITE/manage-client/bin/manage-client.php heartbeat --quiet
  28. # Update check on weekday mornings. Exit code 2 means "update available"; cron
  29. # reports a non-zero exit as mail, which is exactly the notification wanted.
  30. # The backoffice checks on its own when the Maintenance page is opened, so this
  31. # line is only worth having if you want to be told without looking.
  32. 0 8 * * 1-5 $PHP $SITE/manage-client/bin/manage-client.php check --quiet
  33. # Updates are deliberately not installed by either variant. `update` overwrites
  34. # files while the site is live, has no rollback, and may run migrations — that
  35. # belongs in front of a human, at Admin -> Maintenance.