nix/nixos/hosts/framework-server/cron.nix

30 lines
2 KiB
Nix
Raw Normal View History

{ ... }: {
2024-05-01 09:24:11 +02:00
services.cron = {
enable = true;
systemCronJobs = [
# Backups to nuc-docker01
''0 0 * * * root rsync --delete -avr /Storage/Data/Docker/sysctl.io/ root@nuc-docker01:/Storage/Data/Docker/sysctl.io/''
2024-05-27 05:16:52 +02:00
''0 3 * * * root rsync -avr /Storage/Data/Docker/sysctl.io/nextcloud/html/data/albert/files/InstantUpload/ root@nuc-docker01:/Storage/Media/Pictures/InstantUpload/''
''0 5 * * * root rsync -avr /Storage/Data/Docker/sysctl.io/nextcloud/html/data/albert/files/Wallpapers/ root@nuc-docker01:/Storage/Media/Pictures/Wallpapers''
2024-05-01 09:24:11 +02:00
# Back up the docker containers monthly:
''@monthly root ssh nuc-docker01 "rm -rf /Storage/Backups/Docker/sysctl.io/*"; for i in $(docker ps --format '{{.Names}}'); do docker export $i | gzip -cf | ssh root@nuc-docker01 "cat > /Storage/Backups/Docker/sysctl.io/$i.tar.gz"; done''
# Run the ClamAV scan
''@monthly root /Storage/Data/docker-compose/sysctl.io/scripts/clamscan-cron.sh''
# Archive Loki logs monthly
''@monthly root /Storage/Data/docker-compose/sysctl.io/scripts/backup-logs.sh >> /Storage/Data/Temporary/log_backups.log''
# Run the Nextcloud cronjobs hourly
''@hourly root docker exec -uwww-data nextcloud php -f /var/www/html/cron.php''
# Run the Pixelfed scheduler
''* * * * * root docker exec pixelfed-app php artisan schedule:run''
# Update / CLean Mastodon caches
''@daily root docker exec mastodon-web tootctl preview_cards remove --days 7''
''@daily root docker exec mastodon-web tootctl media remove --days 7 --prune-profiles''
''@daily root docker exec mastodon-web tootctl accounts prune''
''@daily root docker exec mastodon-web tootctl statuses remove --days 7''
''@daily root docker exec mastodon-web tootctl media remove --remove-headers --include-follows --days 7''
''@daily root docker exec mastodon-web tootctl preview_cards remove --days 7''
''@daily root docker exec mastodon-web tootctl media remove-orphans''
];
};
2024-01-02 13:26:44 +01:00
}