LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Run script error (https://www.linuxquestions.org/questions/linux-newbie-8/run-script-error-714227/)

ust 03-25-2009 12:29 AM

Run script error
 
I have a script run on unix and linux server , I found that if run it at shell , it works fine , but if run on crontab job , it is not work , can advise what is the different to run on shell and crontab job ? how can I fix it ? thx


the script like below

!/bin/bash

if [ `date +%d` == 18 ]
then
xx

else
yy

fi

your_shadow03 03-25-2009 01:23 AM

Check the permission of the script.
What entry are you providing in the /etc/crontab entry?

chrism01 03-25-2009 05:39 AM

Depends what you mean by 'not work' ... details please.
In any case, the most likely issue is that cron doesn't have much of an environment (eg minimal $PATH), so all cmds should be referenced by their full names eg

/bin/date

instead of just 'date'


All times are GMT -5. The time now is 10:35 PM.