diff --git a/nixos/hosts/framework-server/cron.nix b/nixos/hosts/framework-server/cron.nix index 4f29f069..27194844 100644 --- a/nixos/hosts/framework-server/cron.nix +++ b/nixos/hosts/framework-server/cron.nix @@ -2,21 +2,22 @@ services.cron = { enable = true; systemCronJobs = [ + "* * * * * root `date` > /root/cron.test" # Backups to nuc-docker01 - ''0 0 * * * ${pkgs.rsync}/bin/rsync --delete -avr /Storage/Data/Docker/root@nuc-docker01:/Storage/Data/Docker/'' - ''0 3 * * * ${pkgs.rsync}/bin/rsync -avr /Storage/Data/Docker/nextcloud/html/data/albert/files/InstantUpload/ root@nuc-docker01:/Storage/Video/Pictures/InstantUpload/'' - ''0 5 * * * ${pkgs.rsync}/bin/rsync -avr /Storage/Data/Docker/nextcloud/html/data/albert/files/Wallpapers/ root@nuc-docker01:/Storage/Video/Pictures/Wallpapers'' + ''0 0 * * * root ${pkgs.rsync}/bin/rsync --delete -avr /Storage/Data/Docker/root@nuc-docker01:/Storage/Data/Docker/'' + ''0 3 * * * root ${pkgs.rsync}/bin/rsync -avr /Storage/Data/Docker/nextcloud/html/data/albert/files/InstantUpload/ root@nuc-docker01:/Storage/Video/Pictures/InstantUpload/'' + ''0 5 * * * root ${pkgs.rsync}/bin/rsync -avr /Storage/Data/Docker/nextcloud/html/data/albert/files/Wallpapers/ root@nuc-docker01:/Storage/Video/Pictures/Wallpapers'' # DERP relay certs - ''@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'' + ''@hourly root cp /Storage/Data/Docker/letsencrypt/certs/certs/\*.sysctl.io.crt /Storage/Data/Docker/letsencrypt/certs/certs/derp.sysctl.io.crt'' + ''@hourly root cp /Storage/Data/Docker/letsencrypt/certs/private/\*.sysctl.io.key /Storage/Data/Docker/letsencrypt/certs/private/derp.sysctl.io.key'' # 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'' + ''@weekly 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'' # Set a random Pi-Hole password ''* * * * * /usr/bin/docker exec pihole sudo pihole -a -p $(openssl rand -hex 128)'' # Run the ClamAV scan - ''@monthlysource ~/.bashrc; /Storage/Data/docker-compose/sysctl.io/scripts/clamscan-cron.sh'' + ''@monthly root /Storage/Data/docker-compose/sysctl.io/scripts/clamscan-cron.sh'' # Back up Loki logs monthly - ''@monthly source ~/.bashrc; /Storage/Data/docker-compose/sysctl.io/scripts/backup-logs.sh >> /Storage/Data/Temporary/log_backups.log'' + ''@monthly root /Storage/Data/docker-compose/sysctl.io/scripts/backup-logs.sh >> /Storage/Data/Temporary/log_backups.log'' ]; };