Skip to content

Commit 351a091

Browse files
committed
escape \% in cron
Percent-signs (%) in the command, unless escaped with backslash \, will be changed into newline characters, and all data after the first % will be sent to the command as standard input.
1 parent 4f1ca2c commit 351a091

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

manifests/backup/xtrabackup.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363

6464
$daily_cron_data = ($incremental_backups) ? {
6565
true => {
66-
'directories' => "--incremental-basedir=${backupdir} --target-dir=${backupdir}/$(date +%F_%H-%M-%S)",
66+
'directories' => "--incremental-basedir=${backupdir} --target-dir=${backupdir}/$(date +\%F_\%H-\%M-\%S)",
6767
'weekday' => '1-6',
6868
},
6969
false => {

spec/classes/mysql_backup_xtrabackup_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class { 'mysql::server': }
4444
is_expected.to contain_cron('xtrabackup-daily')
4545
.with(
4646
ensure: 'present',
47-
command: '/usr/local/sbin/xtrabackup.sh --incremental-basedir=/tmp --target-dir=/tmp/$(date +%F_%H-%M-%S) --backup',
47+
command: '/usr/local/sbin/xtrabackup.sh --incremental-basedir=/tmp --target-dir=/tmp/$(date +\%F_\%H-\%M-\%S) --backup',
4848
user: 'root',
4949
hour: '23',
5050
minute: '5',

0 commit comments

Comments
 (0)