Files
Jeffrey Townsend 45dee0c608 Initial.
2015-11-19 22:45:38 +00:00

67 lines
1.5 KiB
Bash

#!/bin/sh
### BEGIN INIT INFO
# Provides: faultd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start Faultd Agent
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
. /lib/lsb/init-functions
DAEMON=/usr/bin/faultd
PIDFILE=/var/run/faultd.pid
FAULTD_OPTS="-dr -pid $PIDFILE"
QUIET=
test -x $DAEMON || exit 5
RUNASUSER=root
UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true
case $1 in
start)
log_daemon_msg "Starting Fault Agent" "faultd"
if [ -z "$UGID" ]; then
log_failure_msg "user \"$RUNASUSER\" does not exist"
exit 1
fi
start-stop-daemon --start $QUIET --oknodo --pidfile $PIDFILE --startas $DAEMON -- $FAULTD_OPTS $FAULTD_EXTRA_OPTS
status=$?
log_end_msg $status
;;
stop)
log_daemon_msg "Stopping Fault Agent" "faultd"
start-stop-daemon --stop $QUIET --oknodo --pidfile $PIDFILE
log_end_msg $?
rm -f $PIDFILE
;;
restart|force-reload)
$0 stop && sleep 2 && $0 start
;;
try-restart)
if $0 status >/dev/null; then
$0 restart
else
exit 0
fi
;;
reload)
log_daemon_msg "Reloading Fault Agent" "faultd"
start-stop-daemon --stop $QUIET --oknodo --pidfile $PIDFILE --signal 1
status=$?
log_end_msg $status
;;
status)
status_of_proc $DAEMON "Fault Agent"
;;
*)
echo "Usage: $0 {start|stop|restart|try-restart|force-reload|reload|status}"
exit 2
;;
esac