Stephen Gran on 1 May 2006 14:34:09 -0000 |
On Mon, May 01, 2006 at 10:04:18AM -0400, Daniel.G.Roberts@sanofi-aventis.com said: > 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 "$@" The standard way of doing this is roughly: case "$1" in start|restart) 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 ;; *) exec $bs_instdir/bin/bb_start "$@" ;; esac $1 contains the first word in the arguments to the script. -- -------------------------------------------------------------------------- | Stephen Gran | Phasers locked on target, Captain. | | steve@lobefin.net | | | http://www.lobefin.net/~steve | | -------------------------------------------------------------------------- Attachment:
signature.asc ___________________________________________________________________________ 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
|
|