Files
bfds-configuration.nix/modules/cron.nix
T
2024-04-16 20:35:54 +00:00

36 lines
1.1 KiB
Nix

{ pkgs, ... }:
{
# name = "Backup spaceboyz web/db"; ## incl. nextcloud-data. leider ist nexcloud ordner nicht dabei
# job = "/root/lokale-scripte/rsync-nextcloud/rsync-nextcloud.sh";
systemd.services.spaceboyz_backup = {
serviceConfig.Type = "oneshot";
serviceConfig.Persistent = true; ## nachholen, wenn heute noch nicht gestartet
serviceConfig.User = "root";
path = with pkgs; [
curl
bash
rsync
openssh
];
script = ''
workDir="/root/lokale-scripte/rsync-nextcloud"
cd $workDir
echo "last run: $(date +%F) $(date +%T)" >> $workDir/last_run
echo "Start run $(date +%F) $(date +%T)" > run.log
bash rsync-nextcloud.sh >> run.log 2>&1
echo "Finish run $(date +%F) $(date +%T)" >> run.log
'';
};
systemd.timers.spaceboyz_backup = {
wantedBy = [ "timers.target" ];
partOf = [ "spaceboyz_backup.service" ];
timerConfig.OnCalendar = [ "*-*-* *:00:00" ]; # ist jetzt stündlich # "daily"; # [ "*-*-* *:*:00" ];
};
}