command isn't working in crontab
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 directory -- phone : +421 917 321 694, web: www.scs.sk -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: 50663428.30809@scs.sk">http://lists.debian.org/50663428.30809@scs.sk |
command isn't working in crontab
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 directory Perhaps 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)"/" -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: 201209282005.23020.neal.p.murphy@alum.wpi.edu">htt p://lists.debian.org/201209282005.23020.neal.p.murphy@alum.wpi.edu |
command isn't working in crontab
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 directory Perhaps 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 |
command isn't working in crontab
On Sat, Sep 29, 2012 at 01:35:04AM +0200, 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 directory Dealing with 'crontab', I used the following time/date sequence: minutes hours day-of-month month day-of-week -------------- In your example, you started with hours, followed by minutes. I hope, my sequence indicated above might work for you. (Have a nice cron) Wilko -- Dabbian is an ancient American word meaning 'I can't put my finger at Ubuntu'. -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: 20120929021110.GA9358@fok01.laje.edewe.de">http://lists.debian.org/20120929021110.GA9358@fok01.laje.edewe.de |
| All times are GMT. The time now is 02:35 AM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.