From: <bl...@us...> - 2004-03-03 16:54:54
|
Update of /cvsroot/devil-linux/build/scripts/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22139/build/scripts/scripts Modified Files: setup Log Message: Immediately start or stop sshd when START_SSHD flag is changed. Index: setup =================================================================== RCS file: /cvsroot/devil-linux/build/scripts/scripts/setup,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- setup 2 Feb 2004 18:41:17 -0000 1.18 +++ setup 3 Mar 2004 16:34:22 -0000 1.19 @@ -172,12 +172,31 @@ [ $RETURN -eq 0 ] && mod_config $CONFIG KEYBOARD_LAYOUT $(cat $RESULT) } +# Start or Stop a service if boot value changes +startstopservice() { + [ "$1" = "$2" ] && return + [ ! -x /etc/init.d/$3 ] && return + echo + case "$2" in + yes) + echo Starting $3 ... + /etc/init.d/$3 start + ;; + no) + echo Stoping $3 ... + /etc/init.d/$3 stop + ;; + esac + pause +} + # Select which services start upon boot startservices() { if [ ! -f $CONFIG ]; then echo "Cannot find: $CONFIG" exit 1 fi + source $CONFIG rm -f $TMP for p in $(grep -v '^#' $CONFIG | grep '^ *START' | sed 's/ //g' | sort) do @@ -205,6 +224,12 @@ do mod_config $CONFIG START_$p yes done + + # Immediately start or stop individual services + old_sshd="${START_SSHD:-no}" + source $CONFIG + startstopservice "$old_sshd" "${START_SSHD:-no}" sshd + unset old_sshd fi } |