System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

how to add the startup script in hp-ux 11.11

rajesh73
Super Advisor

how to add the startup script in hp-ux 11.11

i wan to add below command in hp-ux  startup script , reson is when ever server reboot the license should start automatically

 

command

cd /usr/flex/112.8

./lmstat -c /usr/flex/112.8/license.dat

 

 

8 REPLIES
Laurent Menase
Honored Contributor

Re: how to add the startup script in hp-ux 11.11

in /sbin/init.d/mystartupscript

#!/sbin/sh

#
# mystartup script
#

PATH=/sbin:/usr/sbin:/usr/bin
export PATH

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

case $1 in
start_msg)
        echo "My ownstartup"
        ;;

'start')
        if [ -f /usr/flex/112.8/license.dat ]; then
               

                cd /usr/flex/112.8

               ./lmstat -c /usr/flex/112.8/license.dat


                set_return
        else
                rval=2
        fi
        ;;

*)
        echo "usage: $0 {start}"
        rval=1
        ;;
esac

exit $rval

Then

chmod +500 /sbin/init.d/mystartupscript

ln -s /sbin/init.d/mystartupscript/ /sbin/rc2.d/S995mystartupscript

 

 

just one thing, I supposed that lmstat is self demonizing, else you need to add  a & on lmstat line

rajesh73
Super Advisor

Re: how to add the startup script in hp-ux 11.11

just one thing, I supposed that lmstat is self demonizing, else you need to add a & on lmstat line
ans--sorry i am not understand your question.

if /sbin/rc2.d folder is already exsists. so what can i do.
available foldersin /sbin/rc2.d , /sbin/rc3.d , /sbin/rc4.d
Laurent Menase
Honored Contributor

Re: how to add the startup script in hp-ux 11.11

I just mean that if when you start lmstat it doesn'"t start in background then you need to replace

lmstat -c .... by lmstat -c ... &

 

 

For the run level, you can put it at rc3 ( in rc3.d) if you want, it is a g ood idea

rc4 is usually not used since initdefault is usually 3

 

I put it at rc2.d/S995 like that I was sure it was the last run at rc2

but indeed starting it at rc3.d is a good idea.

rajesh73
Super Advisor

Re: how to add the startup script in hp-ux 11.11

Hi laurent,

thanks for your replay.

why we not use below format


cd /sbin/init.d
vi licstart

cd /usr/flex/112.8

./lmstat -c /usr/flex/112.8/license.dat

:wq

once save the file

ln -s /sbin/init.d/licstart/ /sbin/rc.3/S800licstart


the above procedure is write or wrong. plesae explain below command

ln -s /sbin/init.d/licstart/ /sbin/rc.3/S800licstart - in this command s800licstart what is the meaning for S800
rajesh73
Super Advisor

Re: how to add the startup script in hp-ux 11.11

or else s800 is user defined. please explain
Steven Schweda
Honored Contributor

Re: how to add the startup script in hp-ux 11.11

 
Dennis Handly
Acclaimed Contributor

Re: how to add the startup script in HP-UX 11.11

>ln -s /sbin/init.d/licstart /sbin/rc.3/S800licstart - in this command S800licstart what is the meaning for S800?
>or else S800 is user defined.

 

Yes, S800 is a user defined sequencing number, S for start, K for kill.  See rc(1m):

http://h20000.www2.hp.com/bc/docs/support/SupportManual/c03220515/c03220515.pdf

Laurent Menase
Honored Contributor

Re: how to add the startup script in hp-ux 11.11

oops

ln -s /sbin/init.d/licstart /sbin/rc.3/S800licstart

 

I just put a / by error