cron job not working for some reasons

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

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

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!

  1. Check that your file is executable, if not chmod +rx
  2. Check you mail for message from cron (stdout+stdderr from your script)
  3. Redirect stdout and stderr in a file and checj the result

Jean-Pierre.

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.

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

Thanks guys! My entry is now working! :slight_smile:

1 more question, what does . ~/.profile ; and 2>&1 do?

Thanks!

. ~/.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.

Adding . $HOME/.profile entry to the cron is not a fair idea :slight_smile:
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.

THANKS! :slight_smile:

thanks for the help