You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
771 B
35 lines
771 B
7 years ago
|
#!/bin/sh
|
||
|
|
||
|
. /etc/init.d/globals
|
||
|
|
||
|
SERVICE="$1"
|
||
|
ACTION="$2"
|
||
7 years ago
|
shift 2
|
||
|
OPTIONS="$*"
|
||
7 years ago
|
|
||
|
usage() {
|
||
|
echo "usage: service <name> <action>"
|
||
|
echo " start or stop a given service (init script)"
|
||
|
echo " action depends on the init script"
|
||
|
echo
|
||
|
exit 1
|
||
|
}
|
||
|
|
||
|
test -z "$ACTION" && usage;
|
||
|
|
||
|
for i in /etc/init.d/$SERVICE /var/etc/init.d/$SERVICE; do
|
||
|
if [ -x "$i" ]; then
|
||
7 years ago
|
LOGINFO "running $i $ACTION $OPTIONS"
|
||
|
"$i" "$ACTION" "$OPTIONS"
|
||
7 years ago
|
exit $?
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
echo "$SERVICE not found in /etc/init.d/ and /var/etc/init.d/"
|
||
|
SERVICES=$(for i in /etc/init.d/[^SK]* /var/etc/init.d/[^SK]*; do
|
||
|
echo "${i##*/}";
|
||
|
done | sort -u | grep -v '^\(functions\|globals\|rcK\|rcS\|start\|start_neutrino\|\[\^SK\]\*\)$')
|
||
|
echo "available services:"
|
||
|
echo $SERVICES | xargs -n 1 echo " "
|
||
|
exit 1
|