Operating System - HP-UX
1823420 Members
2595 Online
109655 Solutions
New Discussion юеВ

Cron jobs - Shutdown of SAP & then Server

 
Naveen Shetty
Frequent Advisor

Cron jobs - Shutdown of SAP & then Server

Hi All,

I am having a HP 9000 L1000 Server with SAP R/3 Installed on HP-Unix 11i.

Kindly if someone can guide me, if I need to shutdown SAP database & then Server at certian scheduled time, what is the way I can create CRON Jobs.

Awaiting replies..!

With Regards,
Naveen Shetty.
Queries
7 REPLIES 7
Scott Van Kalken
Esteemed Contributor

Re: Cron jobs - Shutdown of SAP & then Server

as root type in the following:

crontab -e

This will bring you to the cron editor interface.

It's vi based.

you enter the command as follows:

minute hour month day day_of_month weekday command


to shut down sap I'd look for /sbin/init.d/
this would be assuming that SAP follows the HPUX standard of putting startup and shutdown scripts in /sbin/init.d

hope this helps.

Scott.

Naveen Shetty
Frequent Advisor

Re: Cron jobs - Shutdown of SAP & then Server

Hi Scott,

Thank you for your reply..!
Pls note to shutdown the SAP Database it is necessary to login as oracle user & also it is not thru /sbin/init.d/(script).

Kindly suggest..!

With Regds
Naveen Shetty.
Queries
Volker Borowski
Honored Contributor

Re: Cron jobs - Shutdown of SAP & then Server

Hello

as root-cron set

22 00 5 5 * su - sidadm -c "stopsap"

Hope this helps
Volker
Michael Albrecht
New Member

Re: Cron jobs - Shutdown of SAP & then Server

Hi,

create a script and place it in /sbin/init.d

command for stopping sap and oracle in this script like:

su - sapadm -c stopsap

hope that helps
Michael
In pepperland all things are possible
Khurram Khan_1
Advisor

Re: Cron jobs - Shutdown of SAP & then Server

Hi,

You can set up a cron job using the cron -e command, tha sap script to startup or shutdown would be something like the following:

30 4 * * 1-6 /opt/omni/lbin/start_sap_production

where in your case obviously specify the path where the script is, in our case it is in /opt/omni/lbin and owned by root and group is sys. In the start_sap_production script we have the Database server and the app servers, which should be like:

remsh hp01base -n "su - c11adm -c startsap "
remsh hp02base -n "su - c11adm -c startsap &"
remsh hp05base -n "su - c11adm -c startsap &"
remsh hp04base -n "su - c11adm -c startsap &"

Just change the start with stop, and that should work to stop the DB and app servers. Hope this helps, thanks.


Regards


Khurram
Tim Woods_2
Advisor

Re: Cron jobs - Shutdown of SAP & then Server

I have a script that performs a similar action. We run JDE OneWorld and shut it down along with the database every sunday to do a cold backup of the database with Omniback. Here's the script I wrote for it:

# Script shuts down OW and Oracle, performs a cold backup, then restarts them

# Su to jdeb7331 to shut down OneWorld

date > /cron_out/jde.out
su - jdeb7331 -c /u02/oneworld/b7331/system/bin32/EndOneWorld.sh >> /cron_out/jde.out

# Call script to shut down Oracle

date > /cron_out/ora.out
su - oracle -c /app/oracle/cron/orashut.sh >> /cron_out/ora.out

# Back up Oracle databse (/oradata01 and /oradata02)

/opt/omni/bin/omnib 2>&1 -host alphaerp -compress -exclude /stand -exclude /usr -exclude /var -exclude /opt -exclude /tmp -exclude /app -exclude /home -exclude /u02 -exclude /archive -exclude /sbin -exclude /dev -exclude /oraexport -exclude /arc_tmp -exclude /omnidb -exclude /u02/oneworld/b7331/packages -device L180_alphaerp_d1 -protect weeks 3 -keepcatalog weeks 3 -pool production_dlt
echo "The Oracle cold backup on Alphaerp finished on" `date "+%a %m-%d%n"` at `date "+%I:%M %p%n"` | mailx -s "Alphaerp
Cold Backup Complete" root
echo "The Oracle cold backup on Alphaerp finished on" `date "+%a %m-%d%n"` at `date "+%I:%M %p%n"` | mailx -s "Alphaerp
Cold Backup Complete" oracle

# Call script to restart Oracle

date >> /cron_out/ora.out
su - oracle -c /app/oracle/cron/orastart.sh >> /cron_out/ora.out

# Su to jdeb7331 to restart OneWorld

date >> /cron_out/jde.out
su - jdeb7331 -c /u02/oneworld/b7331/system/bin32/rmics.sh >> /cron_out/jde.out
su - jdeb7331 -c /u02/oneworld/b7331/system/bin32/RunOneWorld.sh >> /cron_out/jde.out

Here is the Oracle shutdown script that is called:

svrmgrl mode=line <connect internal
shutdown immediate
exit
EOFDBA
lsnrctl stop

And here is the Oracle startup script that is called:

svrmgrl mode=line <connect internal
startup open
exit
EOFDBA

lsnrctl start

I'm not sure how SAP is started and stopped, but I'd assume it's through a basic command(s) that could be replaced in the first script. Hope this helps.
Helen French
Honored Contributor

Re: Cron jobs - Shutdown of SAP & then Server

Naveen bhai =))

Kaise ho aap ?

I think you should write a script for SAP startup and shutdown, test it with Oracle user id and place it in the cron file. Btw, why do you want to do this ? If this is part of the backup, then look for Backup's pre and post commands/scripts ( like in OB, Legato etc). By doing this, you don't need to setup the cron job; instead configure the start and stop scripts of backup.

HTH,
Shiju
Life is a promise, fulfill it!