LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cronjob not working (https://www.linuxquestions.org/questions/linux-newbie-8/cronjob-not-working-734978/)

vinaytp 06-23-2009 08:32 AM

cronjob not working
 
hi all......

if i execute file: /home/vinay/new it will display date...

i have setup a cronjob like this..

crontab -e

*/1 * * * * /home/vinay/new

and it got installed............

i have started crond demon still it is not displaying date on each minute..

can anyone please help me why this is not working........

Thanks in advance.........

nuwen52 06-23-2009 09:02 AM

Just as a quick test, I created a test script and installed it using your cron line. It worked correctly. Here's the contents of my script:
Code:

#!/bin/sh
date >> /tmp/junk.date


jomen 06-23-2009 09:03 AM

Quote:

if i execute file: /home/vinay/new it will display date...
Execute from a terminal? The output likely will be shown there.
The chronjob probably runs o.k. - you just don't see the output - because there is no terminal.
All just guessed not knowing anything about your program "new".

colucix 06-23-2009 09:06 AM

It looks correct, provided that the file /home/vinay/new have executable permissions. Have you checked if some error message has been sent to your system mail? Or eventually redirect the standard output and the standard error to a file for checking:
Code:

*/1 * * * * /home/vinay/new > /home/vinay/cron.log 2>&1
Also check the file /var/log/cron to see if the cron job has been actually executed. You should see some entries like these:
Code:

Jun 23 16:02:01 linux crond[32620]: (vinay) CMD (/home/vinay/new)
Jun 23 16:03:01 linux crond[32626]: (vinay) CMD (/home/vinay/new)
Jun 23 16:04:01 linux crond[32630]: (vinay) CMD (/home/vinay/new)



All times are GMT -5. The time now is 01:57 AM.