corz.org uses cookies to remember that you've seen this notice explaining that corz.org uses cookies, okay!
corz.org text viewer..
[currently viewing: / public/ linux/ usr/ local/ bin/ service.sh - raw]
SERVICE=$1
COMMAND=$2
service_list() {
echo
echo "[01;33m currently available services..[00m"
echo
for LNAME in /etc/rc.d/rc.* ; do
if [ -x $LNAME ]; then
NAME=`basename $LNAME`
if [ $NAME != 'rc.0' ] && [ $NAME != 'rc.4' ] && [ $NAME != 'rc.6' ] && [ $NAME != 'rc.M' ] && [ $NAME != 'rc.S' ] && [ $NAME != 'rc.K' ] && [ $NAME != 'rc.inet1' ] && [ $NAME != 'rc.inet2' ] && [ $NAME != 'rc.local' ] && [ $NAME != 'rc.sysvinit' ] && [ $NAME != 'rc.font' ]; then
echo "[01;32m ${NAME
fi
fi
done
echo
exit 0
}
do_info() {
echo
echo " [01;32msimple slackware service control..[00m"
echo
echo " [01;33musage: [01;35mservice <service name> <command>[00m"
echo " [01;33mfor example..[00m"
echo
echo " [01;35mservice sshd restart [00m"
echo
echo " [01;33myou can also do[00m [01;35mservice <l|list>[00m[01;33m to get a list of executables[00m[01;33m in[00m [01;35m/etc/rc.d[00m"
echo
exit 0
}
service_control() {
if [ -f /etc/rc.d/rc.${SERVICE} ]; then
/etc/rc.d/rc.${SERVICE} ${COMMAND}
exit 0
else
echo
echo "[01;31m error:[00m[01;33m can't ${COMMAND} ${SERVICE}! that service does not exist![00m"
echo
exit 1
fi
}
case "$1" in
'')
do_info
exit 0
;;
l|list)
service_list
exit 0
;;
*)
service_control
esac