I set up a new cron job. I have set cron jobs many times in the past and never faced issues. For some reasons my new cron job is not working.This is how my cron job looks like. plz help me out guys.
3,8,13,18,23,28,33,38,43,48,53,58 * * * * /siebel/sblp900/home/FSMTaskChk/script
s/FSMTaskChk.ksh > /dev/null 2>&1
aigles
January 8, 2007, 9:44am
2
Your crontab entry seems to be correct.
Change the stdout and stderr redirection from /dev/null to a file.
3,8,13,18,23,28,33,38,43,48,53,58 * * * * /siebel/sblp900/home/FSMTaskChk/scripts/FSMTaskChk.ksh >> /tmpFSMTaskChk.log /2>&1
Check the logfile.
Jean-Pierre.
thanks aigles.. ur solution worked..
i found frm logfile that i didnt source in some variables
Tris
January 9, 2007, 9:46pm
5
Hello!
I would like to ask if Crontab can execute bin files coz' i have this entry and it is not working.
Cron entry
36 10 * * * /bscsprod/bscs/prod/WORK/XREF/tehcron.sh
$cat tehcron.sh
#!/usr/bin/sh
/bscsprod/bscs/prod/WORK/XREF/teh -t -f MPPROFIL
Please advise.
Thanks!
Tris
January 10, 2007, 5:05am
7
The file is executable. Actually, when i manually execute the script it is working. I also tried redirecting the output. No result (0 byte).
I also tried below entry and still no result.
36 10 * * * /bscsprod/bscs/prod/WORK/XREF/teh -t -f MPPROFIL >> /bscsprod/bscs/prod/WORK/XREF/tehcron.log
Thank you.
aigles
January 10, 2007, 5:41am
8
CRON doesn't execute your .profile before executing the command.
If your command needs specific environment initialisation (variables, path...) it may work incorrectly.
In that case try that :
36 10 * * * . ~/.profile ; /bscsprod/bscs/prod/WORK/XREF/teh -t -f MPPROFIL >> /bscsprod/bscs/prod/WORK/XREF/tehcron.log 2>&1
Jean-Pierre.
aigles:
CRON doesn't execute your .profile before executing the command.
If your command needs specific environment initialisation (variables, path...) it may work incorrectly.
In that case try that :
36 10 * * * . ~/.profile ; /bscsprod/bscs/prod/WORK/XREF/teh -t -f MPPROFIL >> /bscsprod/bscs/prod/WORK/XREF/tehcron.log 2>&1
Jean-Pierre.
yea i agree with aigles since if the script depend on environment variable it wont work , so using the above will work
Tris
January 10, 2007, 10:14pm
10
Thanks guys! My entry is now working!
Tris
January 10, 2007, 10:24pm
11
1 more question, what does . ~/.profile ; and 2>&1 do?
Thanks!
aigles
January 11, 2007, 3:24am
12
. ~/.profile ;
. Execute file in current environment
~ Home directory of current user.
; command separator
2>&1
File descriptor 2 (stderr) is to be opened for writing as a duplicate of file descriptor 1 (stdout)
The stderr displays are written in the same file as stdout.
Jean-Pierre.
aigles:
CRON doesn't execute your .profile before executing the command.
If your command needs specific environment initialisation (variables, path...) it may work incorrectly.
In that case try that :
36 10 * * * . ~/.profile ; /bscsprod/bscs/prod/WORK/XREF/teh -t -f MPPROFIL >> /bscsprod/bscs/prod/WORK/XREF/tehcron.log 2>&1
Jean-Pierre.
Adding . $HOME/.profile entry to the cron is not a fair idea
Instead provide the script to be executed via cron the needed environment variables.
With inclusion of .$HOME/.profile all that is not needed by the script is set to the environment.