-
Notifications
You must be signed in to change notification settings - Fork 0
Cron jobs
Jake Jarvis edited this page Jan 8, 2023
·
15 revisions
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
15 3 * * * bash -c "/home/mastodon/utils/scripts/backup.sh >> /home/mastodon/logs/cron-backup.log 2>&1"
- Runs
backup.sh
at 3:15 AM every day: https://crontab.guru/#0_3___* - Keeps last 5 daily backups, last 4 weekly backups, and all monthly backups (for now) in
$BACKUPS_ROOT/{daily,weekly,monthly}
- Optionally syncs backups directory with S3:
- Install
s3cmd
(apt install s3cmd
) & configure it (s3cmd --configure
): https://www.linode.com/docs/products/storage/object-storage/guides/s3cmd/#configuring-s3cmd - Set
BACKUP_S3_BUCKET
to bucket name inutils/.env
- Install
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'"