#! /bin/sh

if [ $# -ne 2 ]; then
    echo "Usage: $0 name [start|stop|configure|unconfigure|...]" 1>&2
    echo 'The following service names are valid on this system:' 1>&2
    ls -C /etc/rc.d 1>&2
    exit 1
fi
if [ ! -f /etc/rc.d/$1 ]; then
    echo "There is no service named \"$1\" (check /etc/rc.d)." 1>&2
    exit 2
fi
. /etc/rc.d/$1
eval ${1}_${2} 2>/dev/null
RET=$?
if [ $RET -eq 127 ]; then
    echo "Service \"$1\" has no \"$2\" action." 1>&2
fi
exit $RET
