简体   繁体   中英

unexpected EOF cronjob error

I have the following cronjob:

2 15 * * * mysqldump -u user -ppass dbname | gzip -9  -c > /var/www/backup/dump-$(date +%Y-%m-%d).sql.gz

but it produces following error:

/bin/sh: -c: line 0: unexpected EOF while looking for matching ')'
/bin/sh: -c: line 1: syntax error: unexpected end of file

I tried ommiting -c but no luck. I have one more line in my crontab but I don't think it's related:

0 0 * * * find /var/www/backup/* -mtime +15 -exec rm {} \;

Thanks

The % character should be escaped in cron .

So,

2 15 * * * mysqldump -u user -ppass dbname | gzip -9  -c > /var/www/backup/dump-$(date +\%Y-\%m-\%d).sql.gz

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM