Created
November 12, 2018 17:48
-
-
Save raghur/d06acd6e705838090992158fbbeb9e95 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Start/stop all init scripts in /opt/etc/init.d including symlinks | |
# starting them in numerical order and | |
# stopping them in reverse numerical order | |
#logger "Started $0${*:+ $*}." | |
ACTION=$1 | |
CALLER=$2 | |
if [ $# -lt 1 ]; then | |
printf "Usage: $0 {start|stop|restart|reconfigure|check|kill}\n" >&2 | |
exit 1 | |
fi | |
[ $ACTION = stop -o $ACTION = restart -o $ACTION = kill ] && ORDER="-r" | |
for i in $(/opt/bin/find /opt/etc/init.d/ -perm '-u+x' -name 'S*' | sort $ORDER ) ; | |
do | |
case "$i" in | |
S* | *.sh ) | |
# Source shell script for speed. | |
trap "" INT QUIT TSTP EXIT | |
#set $1 | |
#echo "trying $i" >> /tmp/rc.log | |
. $i $ACTION $CALLER | |
;; | |
*) | |
# No sh extension, so fork subprocess. | |
$i $ACTION $CALLER | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment