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

60 lines
4.8 KiB
Nix
Raw Normal View History

2024-11-18 20:48:16 +01:00
{ ... }: {
services.cron = {
enable = true;
systemCronJobs = [
# Back up Local-Storage to NFS Storage
2024-12-15 18:53:27 +01:00
"0 9 * * * root rsync -avr /Local-Storage/Data/Docker/ifargle.com/vpn-stack/ /Storage/Data/Docker/ifargle.com/vpn-stack/"
"0 8 * * * root rsync -avr /Local-Storage/Data/Docker/ifargle.com/dsm-kmip/ /Storage/Data/Docker/ifargle.com/dsm-kmip/"
"0 7 * * * root rsync -avr /Local-Storage/Data/Docker/ifargle.com/dsm-kmip-backup/ /Storage/Data/Docker/ifargle.com/dsm-kmip-backup/"
# Back up running containers weekly
"0 0 * * * root rm -rf /Storage/Backups/Docker/ifargle.com/*; for i in $(docker ps --format '{{.Names}}'); do docker export $i | gzip -cf | cat > /Storage/Backups/Docker/ifargle.com/$i.tar.gz; done"
# Restart the VPN stack
"0 0 * * * root /Storage/Data/docker-compose/ifargle.com/scripts/restart-vpn.sh"
];
};
# Old crontab:
# @reboot /usr/bin/mount -a
# @reboot /usr/sbin/modprobe ip_tables
#
# # Sync /Local-Storage/ to /Storage/
# 0 9 * * * /usr/bin/rsync -avr /Local-Storage/Data/Docker/ifargle.com/vpn-stack/ /Storage/Data/Docker/ifargle.com/vpn-stack/
#
# # Sync sysctl.io's docker home:
# # 0 7 * * * /usr/bin/rsync -avr --delete albert@framework-server:/Storage/Data/Docker/ /Storage/Data/Docker/
# # Sync sysctl.io's nextcloud container InstantUpload directory
# # 0 5 * * * /usr/bin/rsync -avr albert@framework-server:/Storage/Data/Docker/nextcloud/html/data/albert/files/InstantUpload/ /Storage/Video/Pictures/InstantUpload/
# # 0 5 * * * /usr/bin/rsync -avr albert@framework-server:/Storage/Data/Docker/nextcloud/html/data/albert/files/Wallpapers/ /Storage/Video/Pictures/Wallpapers
# # Restart VPN Stack
# 0 0 * * * /Storage/Data/docker-compose/ifargle.com/scripts/restart-vpn.sh
# # /usr/bin/reposync currently used repos
# # RHEL / Rocky 8
# @daily /usr/bin/reposync -p /Storage/Data/Software/Repositories/RockyLinux/8/appstream --download-metadata --repo=appstream
# @daily /usr/bin/reposync -p /Storage/Data/Software/Repositories/RockyLinux/8/baseos --download-metadata --repo=baseos
# @daily /usr/bin/reposync -p /Storage/Data/Software/Repositories/RockyLinux/8/docker-ce-stable --download-metadata --repo=docker-ce-stable
# @daily /usr/bin/reposync -p /Storage/Data/Software/Repositories/RockyLinux/8/epel --download-metadata --repo=epel
# @daily /usr/bin/reposync -p /Storage/Data/Software/Repositories/RockyLinux/8/extras --download-metadata --repo=extras
# @daily /usr/bin/reposync -p /Storage/Data/Software/Repositories/RockyLinux/8/powertools --download-metadata --repo=powertools
# @daily /usr/bin/reposync -p /Storage/Data/Software/Repositories/RockyLinux/8/rpmfusion-free-updates --download-metadata --repo=rpmfusion-free-updates
# @daily /usr/bin/reposync -p /Storage/Data/Software/Repositories/RockyLinux/8/tailscale-stable --download-metadata --repo=tailscale-stable
# # RHEL / Rocky 9
# @daily /usr/bin/reposync -p /Storage/Data/Software/Repositories/RockyLinux/9/appstream --download-metadata --repo=appstream --releasever=9
# @daily /usr/bin/reposync -p /Storage/Data/Software/Repositories/RockyLinux/9/baseos --download-metadata --repo=baseos --releasever=9
# @daily /usr/bin/reposync -p /Storage/Data/Software/Repositories/RockyLinux/9/docker-ce-stable --download-metadata --repo=docker-ce-stable --releasever=9
# @daily /usr/bin/reposync -p /Storage/Data/Software/Repositories/RockyLinux/9/epel --download-metadata --repo=epel --releasever=9
# @daily /usr/bin/reposync -p /Storage/Data/Software/Repositories/RockyLinux/9/extras --download-metadata --repo=extras --releasever=9
# @daily /usr/bin/reposync -p /Storage/Data/Software/Repositories/RockyLinux/9/powertools --download-metadata --repo=powertools --releasever=9
# @daily /usr/bin/reposync -p /Storage/Data/Software/Repositories/RockyLinux/9/rpmfusion-free-updates --download-metadata --repo=rpmfusion-free-updates --releasever=9
# @daily /usr/bin/reposync -p /Storage/Data/Software/Repositories/RockyLinux/9/tailscale-stable --download-metadata --repo=tailscale-stable --releasever=9
#
#
# # Back up the running containers weekly
# @weekly source ~/.bashrc; rm -rf /Storage/Backups/Docker/ifargle.com/*; for i in $(docker ps --format '{{.Names}}'); do docker export $i | gzip -cf | cat > /Storage/Backups/Docker/ifargle.com/$i.tar.gz; done
#
# # back up crontab:
# 0 0 * * * /usr/bin/crontab -l > /Storage/Data/Temporary/crontab
2024-03-03 03:12:08 +01:00
}