Daniel.G.Roberts on 1 May 2006 14:04:45 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] Simple Shell help please..


Hi all
I have the /etc/init.d startup script below that I need to modify but I don't script much anymore so I need a bit of help!

I need to test the $@ variable which is shown below and if it is the keyword "start" something else needs to happend...

If on the command line I type

/etc/init.d/bigsister start
or
/etc/init.d/bigsister restart

I need to have the /etc/init.d script see the "start" or "restart" argument and test what the word happens to be. Based on the word, it should then start a different action..see the ## lines
If it is not "start" or "restart" then it can fall through and execute 
exec $bs_instdir/bin/bb_start "$@"

I have added a few comments see ## below to clarify what I am after..
thanks!
Dan


#!/bin/sh
#
# chkconfig: 2345 98 99
# description: Big Sister System and Network Monitor
#
# Wrapper script for bb_start: the init directories should only
# contain shell scripts, no perl scripts ...
#
### BEGIN INIT INFO
# Provides: bigsister
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start: 3 5
# Default-Stop:
# Description: Start and Stop Bigsister
### END INIT INFO

bs_instdir=/usr/share/bigsister

[ -x "$bs_instdir/bin/bb_start" ] || exit 0


##If /etc/init.d/bigsister start or restart do these four lines below
	## export LANG=en_US
	## su bigsis /usr/share/bigsister/bin/bbd
	## su bigsis /usr/share/bigsister/bin/bsmon
	## su bigsis/usr/share/bigsister/uxmon/uxmon

##otherwise do this
exec $bs_instdir/bin/bb_start "$@"
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug