1847253 Members
5280 Online
110263 Solutions
New Discussion

Re: Startscript

 
bazen
Occasional Contributor

Startscript

Hello,

I need to create a start/stop script for SAPR/3. I know how to create start/stop script on Linux(redhat) but I never created one for hp-ux. Any ideas and suggestions? Thanks for your help.

Regards
5 REPLIES 5
Slawomir Gora
Honored Contributor

Re: Startscript

Hi,

create script in /sbin/init.d directory
and link from /sbin/rc2.d/ to start
and link from /sbin/rc1.d to stop

parameters set in /etc/rc.config.d/

Slawomir Gora
Honored Contributor

Re: Startscript

Hi,

look at file
/sbin/init.d/template
Stuart Abramson
Trusted Contributor

Re: Startscript

0. This whole startup/shutdown logic is explained in:

/usr/share/doc/start_up.txt

1. Put the on/off flag in:

/etc/rc.config.c/mqseries

#!/sbin/sh
# @(#) $Revision: 72.3 $
# MQ/Series boot startup configuration file
#
# MQSERIES: Set to 1 to start MQ/Series processes
#
MQSERIES=1

then:

chmod 555 mqseries


If you want MQ/Series to start automatically on boot, set this
value to "1" here.

If not, set it to "0" here.


2. Put the startup script in:

/sbin/init.d/mqseries (Attached)
chown 555 mqseries

3. The startup/shutdown script is based on:

/sbin/init.d/template

3. The MQ/Series startup and shutdown scripts are:

/home/mqm/start_ACADV04D
/home/mqm/stop_I_ACADV04D

They look like this:

/home/mqm/start_ACADV04D

#! /bin/ksh
strmqm ACADV04D
strmqcsv ACADV04D
echo START LISTENER|runmqsc ACADV04D
/home/mqm/mqscripts/runmqtrm_EMPAC.sh

/home/mqm/stop_I_ACADV04D

endmqlsr -m ACADV04D
endmqm -i ACADV04D
endmqlsr -m ACADV04D


4. The startup/shutdown script contains the above statements in the
"start" and "stop" blocks.

'start')
if [ -f /etc/rc.config.d/mqseries ] ; then
. /etc/rc.config.d/mqseries
else
echo "ERROR: /etc/rc.config.d/mqseries defaults
file MISSING"
fi

if [ "$MQSERIES" -eq 1 ]; then
# Start MQ/Series
su - mqm -c /home/mqm/start_ACADV04D
echo "mqseries started"
# set_return
rval=0
else
# Skip
rval=2
fi
;;


'stop')
su - mqm -c /home/mqm/stop_I_ACADV04D
echo "mqseries stopped"
rval=0
;;


5. Now we put links in the /sbin/rc4.d/ directory to point to the
script we just created, for startup processing:

Note: We want MQ/Series to come up AFTER Oracle.

cd /sbin/rc4.d/
ln -s /sbin/init.d/mqseries S200mqseries
chmod 555 S200mqseries

6. And we put a link for shutdown processing:

cd /sbin/rc3.d/
ln -s /sbin/init.d/mqseries K800mqseries
chmod 555 K200mqseries

(A rule of thumb is that the total of S and K numbers = 1000.)


7. You can test the scripts by running:

/sbin/init.d/mqseries start
/sbin/init.d/mqseries stop

8. If you want to disable start/stop on boot for this script do:

/usr/sbin/ch_rc -a -p "MQSERIES=0"

Then, of course, don't forget to reenable automatic boot start with:

/usr/sbin/ch_rc -a -p "MQSERIES=1"

Geoff Wild
Honored Contributor

Re: Startscript

Here's another one:

#!/sbin/sh
# start/stop script for SAP QAS
#
#LSNRCTL=/oracle/QAS/bin/lsnrctl
LSNRCTL=/oracle/QAS/817_64/bin/lsnrctl
QAS_HOME=/home/QASadm
ORA_OWNER=oraQAS
SAP_OWNER=QASadm

rval=0
set_return() {
x=$?
if [ $x -ne 0 ]; then
echo "ERROR CODE $x"
rval=1
fi
}

case "$1" in
start_msg)
echo "Start QAS subsystem"
;;

stop_msg)
echo "Stop QAS subsystem"
;;

start)
if [ -f /etc/rc.config.d/QAS ] ; then
. /etc/rc.config.d/QAS
else
echo "ERROR: /etc/rc.config.d/QAS defaults file MISSING"
fi

# Start the Oracle listener:
# The following command assumes that the oracle login will not prompt the
# user for any values
if [ "$QAS" -eq 1 ]; then
/bin/su - $ORA_OWNER -c "$LSNRCTL start"
/bin/su - $SAP_OWNER -c $QAS_HOME/startsap_svr1007_00
set_return
else
rval=2
fi

;;
stop)
# Stop the Oracle databases:
# The following command assumes that the oracle login will not prompt the
# user for any values
if [ -f /etc/rc.config.d/QAS ] ; then
. /etc/rc.config.d/QAS
else
echo "ERROR: /etc/rc.config.d/QAS defaults file MISSING"
fi

if [ "$QAS" -eq 1 ]; then
/bin/su - $SAP_OWNER -c $QAS_HOME/stopsap_svr1007_00
/bin/su - $ORA_OWNER -c "$LSNRCTL stop"
set_return
else
rval=2
fi

;;
esac

Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Sanjay_6
Honored Contributor

Re: Startscript

hi,

Maybe this link will help,

http://devresource.hp.com/drc/STK/docs/archive/start_up.pdf

Hope this helps.

Regds