LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   script not running as a cron job (https://www.linuxquestions.org/questions/programming-9/script-not-running-as-a-cron-job-257903/)

sanjith11 11-22-2004 06:13 AM

script not running as a cron job
 
Hello all,

a shell script which i have made for some automation works when i run it manually. but the same script dosent work as a cron job.

Does any one out there have any idea why it is like this.


the script basically runs prebuilt scripts owned by diffrent users( call's 1 by 1)

thanks
SaN

Cedrik 11-22-2004 07:16 AM

Try set the PATH with directory where your prebuilt scripts are located in crontab. Did you check
your mail to see the logged errors ?

crontab -e example :
Code:

# you could put env variables here
PATH=$PATH:/home/user/bin:/home/bill/bin:/home/sanjith11/scripts

# cron
30  20  *  *  *  /path/to/script


sanjith11 11-23-2004 06:13 AM

Is there any way to emulate the cron behaviour from the shell itself , so that i can test the script easily without waiting for the cron job to happen.

Cedrik 11-23-2004 06:19 AM

To test your cron you could try :

- on a terminal, type : tty, note the result
- set a cron as this, say your tty is /dev/pts/1 :

* * * * * date >> /dev/pts/1

Now look at your terminal how things go

jlliagre 11-23-2004 08:27 AM

or better:
Code:

* * * * * date > /dev/pts/1 2>/dev/pts/1

dawharl 11-23-2004 08:42 AM

I had a similar problem, but I fixed it:

It was because I ran some other scripts, from the script.
These were not working, because I did not include the full path.

Maybe you're having similar problems, try including full path's to the executables in the script, it might work.

It did for me ;)


All times are GMT -5. The time now is 05:00 PM.