using the percent (%) character in crontab

Long time no blogging.. 🙂

I have been using cron since I started using linux, ages back. I have never needed to use a “%” character within the command line before, since I have been encapsulating everything in scripts. Yesterday I wanted to make one of the scripts here at marin software a tad more generic, and added the line:

0 8 * * * ~/scripts/ "`date +'%F %H:%M:%S' -d yesterday`"

to crontab. Now, this did not work.

I did not know that the “%” character denotes a new line in crontab. Anyway, this is useful if you want to run a script with some percent characters in the input or if you want to run a mysql query containing % in your crontab line.

I guess you learn something new every day, even though this might be a simple thing (you may already know), I just wanted to share it 😉

Comments (1)

robertkApril 15th, 2011 at 11:20 pm

Ok, got some people telling me that there was no fix for this thing.. Well, escapeing it works 🙂




Leave a comment

Your comment