srgb
srgb

Reputation: 5193

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

Upvotes: 2

Views: 1237

Answers (1)

Gilles Quénot
Gilles Quénot

Reputation: 185171

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

Upvotes: 4

Related Questions