1819870 Members
2465 Online
109607 Solutions
New Discussion юеВ

Crontab, Startup scripts

 
SAMIR SHAH_1
Contributor

Crontab, Startup scripts

1. I face one problem nowadays that the cronjobs which are scheduled by root thru SAM are automatically removed from crontab. For eg. If I have scheduled to shutdown the server at certain time and if I see cronjobs thru crontab -l, it will show that job in the file but after sometime, if I give the same command, it does not show there that particular command.

Why it happens so?

2. I want my Oracle database to startup when the server starts. So, I prepared one "test" script and put in /sbin/init.d and then created start and kill links and put them in /sbin/rc3.d and /sbin/rc0.d respectively. I gave file name as S300test.rc and K500test.
But, it has no effect when the server starts.

What should be the problem?

Pl. help.

Thanks in advance.

Samir Shah
8 REPLIES 8
Isralyn Manalac
New Member

Re: Crontab, Startup scripts

Hi,

On the crontab issue, please check if you have the latest cron patch.

On the startup script, I noticed that you named the SXXX script differently as compared to the KXXX script. Aside from the prefix SXXX and KXXX, both should bear the same script name, e.g., S340test.bak and K400test.bak.
Carlos Fernandez Riera
Honored Contributor

Re: Crontab, Startup scripts

The first thing you must do is read /etc/rc.log to see if your startup script was called and errors returned.

Its very usual that you need add PATH, ORACLE_SID and other variables to your script, that are set in your interactive session.
unsupported
Douglas Cromby_1
Valued Contributor

Re: Crontab, Startup scripts

Regarding the startup script, they are usually designed so that the same script is referenced on starting and stopping. For example to stop and start sendmail we do:

/sbin/init.d/sendmail start

/sbin/init.d/sendmail stop

To get it to start automatically, you configure /etc/rc.config.d/mailservs. Could there be an equivalent file there for Oracle?
Victor BERRIDGE
Honored Contributor

Re: Crontab, Startup scripts

Hi,
Here is an example of rc.oracle that you should put in /sbin/init.d:
#!/usr/bin/ksh
export ORACTI_EXPLOIT=/opt/oracle/admin/exploit
export PATH=$PATH:/usr/bin:$ORACTI_EXPLOIT/proc


case "$1" in
start_msg)
echo "Start Oracle"
;;
stop_msg)
echo "Stop Oracle"
;;
start)
$ORACTI_EXPLOIT/proc/db_start
su - oracle -c $ORACTI_EXPLOIT/proc/net_start
;;
stop)
su - oracle -c $ORACTI_EXPLOIT/proc/net_stop
$ORACTI_EXPLOIT/proc/db_shut
;;
*)
echo "usage: $0 {start|stop}"
#rval=1
;;
esac
==================
Then you will have to make the links Sxxxoracle and Kxxxoracle in the runlevel you have chosen.
You have have to adapt it to your needs...
As already mentionned by Carlos, the env has to be defined (ORACLE_HOME if you use it , PATH...)

Good luck
Victor


Andreas D. Skjervold
Honored Contributor

Re: Crontab, Startup scripts

Hi!
You might also want to edit your oratab file to read:
::Y
if your scripts is utilizing the Oracle-supplied scripts dbstart / dbshut located in $ORACLE_HOME/bin
Y in the last column starts the corresponding db at system start(assuming the rest of the scripts are set up correct).

Andreas
Only by ignoring what everyone think is important, can you be aware of what everyone ignores!
Joseph C. Denman
Honored Contributor

Re: Crontab, Startup scripts

As far as the cron....As stated earlier, I would check for the latest patch.

On the Oracle start/stop. I have attached a copy of my /sbin/init.d/oracle file I use to start and stop. This uses the oracle release dbshut and dbstart.

You will need to put your links in your respective rc directory. Plus you will need the file /etc/rc.config.d/oracle stating ORACLE_START=1
If I had only read the instructions first??
Joseph C. Denman
Honored Contributor

Re: Crontab, Startup scripts

Oh...The script uses oracle7 as oracle. You will need to modify it to oracle or (the oracle software owner)

Also, you need to make sure the /etc/oratab file has a Y at the end of the instances you want started and stopped.

Hope this helps.
If I had only read the instructions first??
Kurtkarl
Frequent Advisor

Re: Crontab, Startup scripts

Tought it might help for your startup script.

Try to check also the actual script file mode/permission if it's executable.
Just starting to learn thru this forum