Skip to content

Cron jobs

Jake Jarvis edited this page Jan 8, 2023 · 15 revisions

Media cleanup

0 3 * * 0  bash -c "/home/mastodon/utils/scripts/purge.sh >> /home/mastodon/logs/cron-purge.log 2>&1"
  • Runs purge.sh at 3 AM on Sundays: https://crontab.guru/#0_3_*_*_0
    • Keeps last 14 days of media (images, videos) in posts
    • Keeps last 90 days of profile media (avatars, headers, etc.)
    • Keeps last 90 days of link preview cards

Backups

15 3 * * *  bash -c "/home/mastodon/utils/scripts/backup.sh >> /home/mastodon/logs/cron-backup.log 2>&1"

Sending heartbeats

Append a curl command to send heartbeat to a Better Uptime endpoint (or any other service) only if the script was successful:

0 3 * * 0  bash -c "(/home/mastodon/utils/scripts/weekly_cleanup.sh >> /home/mastodon/logs/cron.log 2>&1) && curl -X GET 'https://betteruptime.com/api/v1/heartbeat/XXXXXX'"
Clone this wiki locally