cancel
Showing results for 
Search instead for 
Did you mean: 

How to start sap on linux while booting?

Former Member
0 Kudos

Hi all,

I want to start and stop SAP automatically when the system starts or is stopped.

In earlier Suse (SLES 9) releases there was a script sapr3 in /etc/init.d which could be used for it, when the file /etc/sysconfig/sapr3 was filled correctly.

In newer releases (SLES 10) there is no such script (besides boot.sapconf, which is uesd to set the sap parameters).

Does anybody know how to start and stop sap systems using the init.d mechanism?

Thank you for you help.

Best regards

Christian

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You are right, the files came from the sapinit package, under SLES9 the sapr3 script was delivered. The new one is the sapinit script, but this only seems to start the sapstartsrv process.

SLES9

root # cat /etc/SuSE-release 
SUSE LINUX Enterprise Server 9 (x86_64)
VERSION = 9
PATCHLEVEL = 3
/root #  rpm -q sapinit-1.0-0.8 -l
/etc/cron.d/sap
/etc/init.d/sapr3
/etc/sysctl.conf.sap
/usr/sbin/rcsapr3
/usr/share/doc/packages/sapinit
/usr/share/doc/packages/sapinit/COPYING
/var/adm/fillup-templates/sysconfig.sapr3

SLES10

root # cat /etc/SuSE-release 
SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10
PATCHLEVEL = 2
root # rpm -q sapinit-3.0-1.4 -l
/etc/init.d/boot.sapconf
/etc/init.d/sapinit
/lib64/sapinit
/lib64/sapinit/README
/lib64/sapinit/config.b32
/lib64/sapinit/config.b64
/lib64/sapinit/functions
/usr/sbin/SAPconf
/usr/sbin/SAPinit
/usr/share/doc/packages/sapinit
/usr/share/doc/packages/sapinit/LGPL
/usr/share/doc/packages/sapinit/README
/var/adm/fillup-templates/sysconfig.sapinit

From OS perspective the mechanism didn't change between SLES 9 and 10. If you still have access to the original script, then you can tryp to copy it to /etc/init.d (and /etc/sysconfig) and create the links.

Cheers Michael

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi mho,

I do not understand this.

Yes, of course I did so for some systems, but in note 1275776 - Linux: Preparing SLES for SAP environments is mentioned the following:

Older versions of this package (including the package found in SLES 9 SP3 and SLES 10) had an init script called "/etc/init.d/sapr3" resp. "/usr/sbin/rcsapr3". This has been renamed to "/etc/init.d/boot.sapconf", because R3 is not really true nowadays anymore.

Also, the old script was supposed to be able to start up SAP R3 instances, when these were configured in the "/etc/sysconfig/sapr3" file. This configuration file has now been obsoleted. The new "/etc/init.d/boot.sapconf" script delivered with this package does not have the capability to start any SAP (R3) instances. This functionality has been replaced by the scripts delivered with the SAP system itself.

Anybody who figured out how this would work using the init.d mechanism?

Thank you for advise.

Christian

nelis
Active Contributor
0 Kudos

What don't you understand ?

The functionality no longer exists in the current scripting form, if you want it create your own. Personally, I wouldn't bother as it's not very often that you need to reboot the system except when you have updated the kernel or have made hardware changes. Even then, I would rather want to check the system after a reboot before starting SAP.

--

Nelis

Former Member
0 Kudos

Hi Nelis,

I do understand, that the function does no longer exist. But how to "create your own".

It is just clear, that I should check the system after a shutdown, but what if I just want the sap to start after reboot?

Best regards

Christian

nelis
Active Contributor
0 Kudos

I do understand, that the function does no longer exist. But how to "create your own".

If I were to create one I'd use something along the following lines...


#! /bin/sh
#
# SAP startup script - sapstart
# chkconfig sapstart on - to enable on startup
# Replace SAPEXE,ADMUSR and SLOG below with correct values

### BEGIN INIT INFO
# Provides: sapstart
# Required-Start: $network $syslog $remote_fs $time
# X-UnitedLinux-Should-Start:
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Start SAP
# Description: Startup of SAP 
### END INIT INFO

. /etc/rc.status

PATH=/sbin:/bin:/usr/sbin:/usr/bin; export PATH
SAPEXE=/sapmnt/DEV/exe
ADMUSR=devadm
SLOG=/var/log/saplog
SHELL=/bin/csh

# Reset status of this service
rc_reset

case "$1" in
    start)
	echo -n "Starting SAP.. "
	su -s $SHELL -l $ADMUSR -c $SAPEXE/startsap >> $SLOG &

	# Remember status and be verbose
	rc_status -v
	;;
    stop)
	echo -n "Please ensure SAP is cleanly shutdown before rebooting!.. "

	# Remember status and be verbose
	rc_status -v
	;;
    *)
	echo "Usage: $0 {start|stop}"
	exit 1
	;;
esac
rc_exit

I deliberately left out 'stop' for obvious reasons, don't forget to create the log file.

Untested so use at your own risk !

--

Nelis

Former Member
0 Kudos

Hi Nelis,

thank you a lot.

So nobody came across a solution from SAP to start and stop SAP while starting and stopping the OS.

So it would be the best to use the old script (which allows shutting down SAP, too) or your "untested" script, which denies shutting down SAP.

Wouldn't it be better to use a script to shutdown SAP when os goes down (to get a clean shutdown of SAP (do not forget to stop is while rebooting)) instead of starting SAP automatically (after a crash of OS)? I know your script is a "proof of concept" , I am only interested.

Thank you

Christian

nelis
Active Contributor
0 Kudos

The problem is even when executing 'stopsap' manually you are not guaranteed SAP will shutdown cleanly and the database might still be up. Of course you could always add these kind of checks to the 'stop' section of the script but it would be dependent on the database being used etc ...which is why I left it out.

--

Nelis

Former Member
0 Kudos

But to try to stop it with a script is still better, than not doing anything at all.

If you have the time to do it manually you always have this option, regardless wether a stop script is in place. At our site we always configure the start/stop scripts. So a basis guy is not necessarily needed in case a technician or unix admin is doing maintenance on dev and qas systems.

Cheers Michael

nelis
Active Contributor
0 Kudos

You have a point but...

At our site, I would prefer it if there was any maintenance to be done on our SAP systems that a Basis person be contacted first so we can be assured of no unforeseen surprises. I like to know what is being done on the OS level at all times

--

Nelis

Former Member
0 Kudos

Hi,

in my opinion, it is always good to try a clean shutdown when the system must go down.

Not in every case there is a consultant at hand, i.e. power failure, the systems must be shut down in case of emergency ... a script will be usefull.

I think it is more important to find out what happend before the system is started again.

Christian