Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Crontabs and Oracle
Kevin,
Here's a trick to get all you need in a shell script for a cron job.
This is useful for situations such as yours where you just can't seem to get the environment set correctly.
Run your job from the command line to make sure it works. I assume that you've already done this.
Now set your job up to run via the 'at' command:
at 22:30 -f myjob.sh
( syntax may not be exact :)
Now will be be given a job #
$ > at now + 1 hour
at> ls -l
at> <EOT>
commands will be executed using /bin/ksh
job 1007064577.a at Thu Nov 29 12:09:37 2001
Now I have job 1007064577 set in at.
On solaris you can get a copy of that job at
/var/spool/cron/atjobs/1007064577.a
Copy this file to a test shell script. It will have your entire environment in it, as well as everything else to run the job. You can edit it to get rid of stuff you're sure you don't need.
I've seen a number of suggestions for sourcing .profile in the cron jobs, but this is not always a good idea, as .profile often contains script that will not execute when not attached to a tty.
HTH Jared
PS. Don't forget to cancel the phony job via 'atrm'.
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: Jared.Still_at_radisys.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Thu Nov 29 2001 - 13:26:30 CST
![]() |
![]() |