1845914 Members
4583 Online
110250 Solutions
New Discussion

Re: script question

 
navin
Super Advisor

script question

Hello,
I'm not a scripting person.I have an application script.And wanted to set it up for start at boot.I have copied the script to appropriate dir and created links.And posted a script here.Could some one take a look and please advice if it looks right in general.Really appreciate you.
Thanks
#!/bin/sh

if [ $# -ne 1 ]; then
echo "Usage: $0 {start|stop|restart}"
exit 1
fi

SWSBIN=/export/home/application/swt/sws/sws2007/bin


case "$1" in
'start')
echo "Starting sws"
/bin/su sws -c $SWSBIN/sws start
;;
'stop')
echo "Stopping sws"
/bin/su sws -c $SWSBIN/sws stop
;;
esac
#
Learning ...
6 REPLIES 6
Manuales
Super Advisor

Re: script question

it looks right ..
Ivan Ferreira
Honored Contributor

Re: script question

I think that is correct. I would add:

restart)
echo "Restarting sws"
/bin/su sws -c $SWSBIN/sws stop
/bin/su sws -c $SWSBIN/sws start
;;
status)
ps -ef |grep
;;


The status should be modified so the script is able to report if the service is running or not.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Dennis Handly
Acclaimed Contributor

Re: script question

If this is a rc(1M) script, you need to look at the man page:
http://docs.hp.com/en/B2355-60130/rc.1M.html

It needs: start stop start_msg stop_msg
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1140119

>'start')

There is no need to quote those patterns.

>/bin/su sws -c $SWSBIN/sws start

The string after -c must be quoted if more than one token:
/bin/su sws -c "$SWSBIN/sws start"
navin
Super Advisor

Re: script question

Thanks for all your reply.
I will be testing this tomorrow.Until that i would like to keep this thread open .Then surey i will assign the points .
Thanks again for taking time to reply.
Learning ...
navin
Super Advisor

Re: script question

Thanks for your reply.I would like keep this thread open till tomorrow then surely i will assign the points.Thanks again for your time.
Learning ...
Peter Nikitka
Honored Contributor

Re: script question

Hi,

to be HP-UX complaint, you'd have to code the additional options

start_msg) echo Starting xxx ;;
stop_msg) echo Stopping xxx ;;

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"