I have written a shell script and when i run it from shell prompt it runs fine but in the cron it only runs partially.
That means cron is working fine.
there is a command which i am using in the script which doesn't run at all.
That comman uses different user privileges like ptadmin
i am not sure how to make this work.
What I am thinking is that particular comman exports the database from oracle and it take 20-25 min to execute it while i run manually. but in the cron it looks like it doesn't even try it.
Although i have checked the log file and cron is creating log file so its executing but.
Any thoughts fellows.
Check your environment differences between command line and cron.
$ env > /tmp/mycommandline.env
and add that command to your script
env > /tmp/mycron.env
Then check that you are giving the full path to commands in your script.
Read the man page on cron, crontab for further information such as:
The shell is invoked from your $HOME directory with an arg0
of sh. Users who desire to have their .profile executed must
explicitly do so in the crontab file.
thanks fellows..
I have added my commandline enviornment to my script ..
it didn't work but later on i changed my shell to k shell and it worked like piece of cake.
In ksh after my enviornment variable i used export.
e.g.
PATH=/usr/abc:/usr/bcd; export PATH;
..
does somebody know how to do the same in csh & bourne shell.