# functions that are used by init scripts... . /etc/init.d/globals run_initscripts() { if [ "x$1" == xstop ]; then action="stop" doing="stopping" files="/etc/init.d/K[0-9][0-9]* /var/etc/init.d/K[0-9][0-9]*" else action="start" doing="starting" files="/etc/init.d/S[0-9][0-9]* /var/etc/init.d/S[0-9][0-9]*" fi names=$(for file in $files ; do echo ${file##*/} ; done | sort -u) for name in $names; do [ "${name:1}" = "[0-9][0-9]*" ] && continue for file in /etc/init.d/$name /var/etc/init.d/$name; do if [ -x "$file" ]; then LOGINFO "$doing $file ..." "$file" $action break; fi done done }