I am trying to make a crontab
that makes a new .tar
file each minute every business day by using the following code:
*/1 * * * 1,2,3,4,5 tar -cf /home/user/Archiv/$(date +"%Y%m%d%H%M").tar /home/user/Textverarbeitung/ -P
This doesn't work. Why?
Best Answer
cron
treats%
as newlines. You need to use escape it i.e. use\%
to get literal%
as used indate
.So you need:
Or you can use a script and use all the commands in the script and call the script from
crontab
.From
man 5 crontab
: