From 581900f92b8ecf20f4c7cfd7fa2eab5c56f53caf Mon Sep 17 00:00:00 2001 From: iFargle Date: Wed, 27 Dec 2023 20:54:13 +0900 Subject: [PATCH] Add Mastodon cache cleanup --- nixos/hosts/framework-server/cron.nix | 54 ++++++++++++++++----------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/nixos/hosts/framework-server/cron.nix b/nixos/hosts/framework-server/cron.nix index 893bf042..104fdd13 100644 --- a/nixos/hosts/framework-server/cron.nix +++ b/nixos/hosts/framework-server/cron.nix @@ -21,6 +21,16 @@ ''@monthly root /Storage/Data/docker-compose/sysctl.io/scripts/clamscan-cron.sh'' # 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'' ]; }; @@ -36,39 +46,39 @@ # # # Clean up NextCloud files weekly to save space # @weekly source ~/.bashrc; /usr/bin/docker exec -uwww-data nextcloud php occ versions:cleanup -# # Run the Nextcloud cronjobs hourly -# DONE @hourly source ~/.bashrc; /usr/bin/docker exec -uwww-data nextcloud php -f /var/www/html/cron.php +# DONE # Run the Nextcloud cronjobs hourly +# DONE @hourly source ~/.bashrc; /usr/bin/docker exec -uwww-data nextcloud php -f /var/www/html/cron.php # # # # Clear out Mastodon caches daily -# @daily source ~/.bashrc; /usr/bin/docker exec mastodon-web tootctl preview_cards remove --days 1 -# @daily source ~/.bashrc; /usr/bin/docker exec mastodon-web tootctl media remove --days 1 --prune-profiles -# @daily source ~/.bashrc; /usr/bin/docker exec mastodon-web tootctl accounts prune -# @daily source ~/.bashrc; /usr/bin/docker exec mastodon-web tootctl statuses remove --days 1 -# @daily source ~/.bashrc; /usr/bin/docker exec mastodon-web tootctl media remove --remove-headers --include-follows --days 0 -# @daily source ~/.bashrc; /usr/bin/docker exec mastodon-web tootctl preview_cards remove --days 1 -# @daily source ~/.bashrc; /usr/bin/docker exec mastodon-web tootctl media remove-orphans +# DONE @daily source ~/.bashrc; /usr/bin/docker exec mastodon-web tootctl preview_cards remove --days 1 +# DONE @daily source ~/.bashrc; /usr/bin/docker exec mastodon-web tootctl media remove --days 1 --prune-profiles +# DONE @daily source ~/.bashrc; /usr/bin/docker exec mastodon-web tootctl accounts prune +# DONE @daily source ~/.bashrc; /usr/bin/docker exec mastodon-web tootctl statuses remove --days 1 +# DONE @daily source ~/.bashrc; /usr/bin/docker exec mastodon-web tootctl media remove --remove-headers --include-follows --days 0 +# DONE @daily source ~/.bashrc; /usr/bin/docker exec mastodon-web tootctl preview_cards remove --days 1 +# DONE @daily source ~/.bashrc; /usr/bin/docker exec mastodon-web tootctl media remove-orphans # -# # Run the Pixelfed scheduler -# * * * * * /usr/bin/docker exec pixelfed-app php artisan schedule:run +# DONE # Run the Pixelfed scheduler +# DONE * * * * * /usr/bin/docker exec pixelfed-app php artisan schedule:run # -# # Run the ClamAV scan -# @monthly source ~/.bashrc; /Storage/Data/docker-compose/sysctl.io/scripts/clamscan-cron.sh +# DONE # Run the ClamAV scan +# DONE @monthly source ~/.bashrc; /Storage/Data/docker-compose/sysctl.io/scripts/clamscan-cron.sh # -# # Set a random PiHole password every minute -# * * * * * /usr/bin/docker exec pihole sudo pihole -a -p $(openssl rand -hex 128) +# DONE # Set a random PiHole password every minute +# DONE * * * * * /usr/bin/docker exec pihole sudo pihole -a -p $(openssl rand -hex 128) # -# # back up crontab: -# # 0 0 * * * /usr/bin/crontab -l > /Storage/Data/Temporary/crontab +# NOT NEEDED # back up crontab: +# NOT NEEDED # 0 0 * * * /usr/bin/crontab -l > /Storage/Data/Temporary/crontab # # # Back up and delete local copies of Loki logs monthly -# @monthly source ~/.bashrc; /Storage/Data/docker-compose/sysctl.io/scripts/backup-logs.sh >> /Storage/Data/Temporary/log_backups.log +# DONE @monthly source ~/.bashrc; /Storage/Data/docker-compose/sysctl.io/scripts/backup-logs.sh >> /Storage/Data/Temporary/log_backups.log # -# # Back up the docker containers weekly: -# @weekly source ~/.bashrc; 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 +# DONE # Back up the docker containers weekly: +# DONE @weekly source ~/.bashrc; 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 # # # Set up DERP relay certs for headscale-derp: -# @hourly cp /Storage/Data/Docker/letsencrypt/certs/certs/\*.sysctl.io.crt /Storage/Data/Docker/letsencrypt/certs/certs/derp.sysctl.io.crt -# @hourly cp /Storage/Data/Docker/letsencrypt/certs/private/\*.sysctl.io.key /Storage/Data/Docker/letsencrypt/certs/private/derp.sysctl.io.key +# DONE @hourly cp /Storage/Data/Docker/letsencrypt/certs/certs/\*.sysctl.io.crt /Storage/Data/Docker/letsencrypt/certs/certs/derp.sysctl.io.crt +# DONE @hourly cp /Storage/Data/Docker/letsencrypt/certs/private/\*.sysctl.io.key /Storage/Data/Docker/letsencrypt/certs/private/derp.sysctl.io.key } \ No newline at end of file