@@ -31,7 +31,7 @@ class { 'mysql::server': }
31
31
is_expected . to contain_cron ( 'xtrabackup-weekly' )
32
32
. with (
33
33
ensure : 'present' ,
34
- command : '/usr/local/sbin/xtrabackup.sh --target-dir=/tmp/$(date +\%F_\%H-\%M-\%S) --backup' ,
34
+ command : '/usr/local/sbin/xtrabackup.sh --target-dir=/tmp/$(date +\%F)_full --backup' ,
35
35
user : 'root' ,
36
36
hour : '23' ,
37
37
minute : '5' ,
@@ -41,10 +41,16 @@ class { 'mysql::server': }
41
41
end
42
42
43
43
it 'contains the daily cronjob for weekdays 1-6' do
44
+ dateformat = case facts [ :osfamily ]
45
+ when 'FreeBSD' , 'OpenBSD'
46
+ '$(date -v-sun +\%F)_full'
47
+ else
48
+ '$(date -d "last sunday" +\%F)_full'
49
+ end
44
50
is_expected . to contain_cron ( 'xtrabackup-daily' )
45
51
. with (
46
52
ensure : 'present' ,
47
- command : ' /usr/local/sbin/xtrabackup.sh --incremental-basedir=/tmp --target-dir=/tmp/$(date +\%F_\%H-\%M-\%S) --backup' ,
53
+ command : " /usr/local/sbin/xtrabackup.sh --incremental-basedir=/tmp/ #{ dateformat } --target-dir=/tmp/$(date +\\ \ % F_\\ \ % H-\\ \ % M-\\ \ % S) --backup" ,
48
54
user : 'root' ,
49
55
hour : '23' ,
50
56
minute : '5' ,
@@ -84,11 +90,18 @@ class { 'mysql::server': }
84
90
{ additional_cron_args : '--backup --skip-ssl' } . merge ( default_params )
85
91
end
86
92
93
+ dateformat = case facts [ :osfamily ]
94
+ when 'FreeBSD' , 'OpenBSD'
95
+ '$(date -v-sun +\%F)_full'
96
+ else
97
+ '$(date -d "last sunday" +\%F)_full'
98
+ end
99
+
87
100
it 'contains the weekly cronjob' do
88
101
is_expected . to contain_cron ( 'xtrabackup-weekly' )
89
102
. with (
90
103
ensure : 'present' ,
91
- command : '/usr/local/sbin/xtrabackup.sh --target-dir=/tmp/$(date +\%F_\%H-\%M-\%S) --backup --skip-ssl' ,
104
+ command : '/usr/local/sbin/xtrabackup.sh --target-dir=/tmp/$(date +\%F)_full --backup --skip-ssl' ,
92
105
user : 'root' ,
93
106
hour : '23' ,
94
107
minute : '5' ,
@@ -101,7 +114,7 @@ class { 'mysql::server': }
101
114
is_expected . to contain_cron ( 'xtrabackup-daily' )
102
115
. with (
103
116
ensure : 'present' ,
104
- command : ' /usr/local/sbin/xtrabackup.sh --incremental-basedir=/tmp --target-dir=/tmp/$(date +\%F_\%H-\%M-\%S) --backup --skip-ssl' ,
117
+ command : " /usr/local/sbin/xtrabackup.sh --incremental-basedir=/tmp/ #{ dateformat } --target-dir=/tmp/$(date +\\ \ % F_\\ \ % H-\\ \ % M-\\ \ % S) --backup --skip-ssl" ,
105
118
user : 'root' ,
106
119
hour : '23' ,
107
120
minute : '5' ,
0 commit comments