double quotes are OK but % is not, it is special character in
crontab , I have found it here
http://en.wikipedia.org/wiki/Cron On 29.09.2012 02:05, Neal Murphy wrote: On Friday, September 28, 2012 07:35:04 PM Tomas Hulata wrote:Hello, below command works in command line but not as a cronjob can someone explain me why? 23 58 * * * root cd /some_path/;mkdir "CAM1-$(date +%d.%m.%Y)";mv ./CAM1/*.* ./"CAM1-$(date +%d.%m.%Y)"/;mkdir "CAM2-$(date +%d.%m.%Y)";mv ./CAM2/*.* ./"CAM2-$(date +%d.%m.%Y)"/ I want to move files from /some_path/CAM1 directory to directory called CAM1-'today date' and the same for /some_path/CAM2 directoryPerhaps cron doesn't know how to run those commands. Try: 23 58 * * * root /bin/bash -c "cd /some_path/;mkdir \"CAM1-$(date +%d. %m.%Y)\";mv ./CAM1/*.* ./\"CAM1-$(date +%d.%m.%Y)\"/;mkdir \"CAM2-$(date +%d. %m.%Y)\";mv ./CAM2/*.* ./\"CAM2-$(date +%d.%m.%Y)\"/" -- phone : +421 917 321 694, web: www.scs.sk |