add cron.nix
This commit is contained in:
1 parent
1d59357a80
commit
41305428b2
1 file changed
+35
@@ -0,0 +1,35 @@
|
||||
{ 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" ];
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user