浏览代码

Save and load env for cron tasks; fixed monthly/weekly order

tags/v1.1.0^0
Robin Thoni 5 年前
父节点
当前提交
db08443a73
共有 2 个文件被更改,包括 7 次插入5 次删除
  1. 4
    4
      rsnapshot/config/rsnapshot.cron.conf
  2. 3
    1
      rsnapshot/run.sh

+ 4
- 4
rsnapshot/config/rsnapshot.cron.conf 查看文件

@@ -5,7 +5,7 @@
5 5
 # To activate this cron file you have to uncomment the lines below.
6 6
 # Feel free to adapt it to your needs.
7 7
 
8
-# 00 */4		* * *		root	/usr/bin/rsnapshot hourly
9
- 00  3  	* * *		root	/usr/bin/rsnapshot daily
10
- 50  2  	* * 1		root	/usr/bin/rsnapshot weekly
11
- 55  2  	1 * *		root	/usr/bin/rsnapshot monthly
8
+# 00 */4		* * *		root	. /tmp/env; /usr/bin/rsnapshot hourly
9
+ 00  3  	* * *		root	. /tmp/env; /usr/bin/rsnapshot daily
10
+ 55  2  	* * 1		root	. /tmp/env; /usr/bin/rsnapshot weekly
11
+ 50  2  	1 * *		root	. /tmp/env; /usr/bin/rsnapshot monthly

+ 3
- 1
rsnapshot/run.sh 查看文件

@@ -4,4 +4,6 @@
4 4
 
5 5
 replace_files
6 6
 
7
-cron -f
7
+env | grep -Ev 'BASHOPTS|BASH_VERSINFO|EUID|PPID|SHELLOPTS|UID' | sed 's/^\(.*\)$/export \1/' > /tmp/env
8
+
9
+cron -fn

正在加载...
取消
保存