Running ksh script from a crontab job
Posted on 2013-06-24
I have a ksh script that writes data to a file and then sends out an e-mail with that file embeded into the e-mail. I need this job to run every Sunday at 3am. Below is my crontab entry:
00 03 * * 0 Scripts/myscript.ksh 2>&1
At exactly 3am I get an e-mail with the correct subject but there is no content - the file does not get embedded. If I run my ksh script manually i get an e-mail with a content.
I have one idea - in my script the full path to the file to be e-mailed is $ORACLE_BASE/Scripts/myscript.ksh, and I know crontab does not allow environmental variables. Of course the variable is in the ksh script but I have no clue if it makes any difference to the crontab.
P.S I also knoe that listing the path to the script as Script/myscript.ksh is fine because that's how all other scripts are listedin the crontab.
Does anyone have any ideas why my file does not get e-mailed?
The command I use to e-mail the file is:
mail -s "My subject" "$email1" < $FILE1