Browse Source

moved crontab to env

admin 1 year ago
parent
commit
9a02d3a622
3 changed files with 11 additions and 14 deletions
  1. 9 0
      restic/.env.template
  2. 0 13
      restic/data/restic/crontab.txt
  3. 2 1
      restic/data/restic/entry.sh

+ 9 - 0
restic/.env.template

@@ -22,3 +22,12 @@ RESTIC_REPOSITORY=s3:https://example.ulm-store.de/mybackup
 # Timezone (see https://github.com/restic/restic/issues/2534)
 TZ=Europe/Berlin
 
+# Entry added into crontab
+CRONTAB=30 22  *  *  * /root/restic/run.sh 0 2>&1
+#        *  *  *  *  *
+#        |  |  |  |  |__ Weekday (0-7, Sunday is 0 7)
+#        |  |  |  |______Month (1-12)
+#        |  |  |_________Day (1-31)
+#        |  |____________Hour (0-23)
+#        |_______________Minute (0-59)
+

+ 0 - 13
restic/data/restic/crontab.txt

@@ -1,13 +0,0 @@
-# * * * * *
-# | | | | |─── Weekday (0-7, Sunday is 0 7)
-# | | | |└─────Month (1-12)
-# | | |└───────Day (1-31)
-# | |──────────Hour (0-23)
-# |└───────────Minute (0-59)
-
-# Run each day 1:45
-45 1 * * * /root/restic/run.sh 0 2>&1
-
-
-# Run every minute for debugging
-#*/1 * * * * /root/restic/run.sh 0 2>&1

+ 2 - 1
restic/data/restic/entry.sh

@@ -1,7 +1,8 @@
 #!/bin/sh -x
 
 # Import cron file
-/usr/bin/crontab /root/restic/crontab.txt
+#/usr/bin/crontab /root/restic/crontab.txt
+echo "$CRONTAB" | crontab -
 
 # Start cron
 /usr/sbin/crond -f -L /dev/stdout