File samhain.init of Package samhain
#! /bin/sh
#
# /etc/init.d/samhain
#
# and symbolic its link
#
# /usr/sbin/rcsamhain
#
### BEGIN INIT INFO
# Provides: samhain
# Required-Start: $syslog $network $remote_fs
# Required-Stop: $syslog $network
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: Keep an eye on stuff
# Description: Keep an eye on stuff
### END INIT INFO
. /etc/rc.status
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
# First reset status of this service
rc_reset
NAME=samhain
DAEMON=/usr/sbin/${NAME}
PID=/var/run/${NAME}.pid
# check for sysconfig
test -f /etc/sysconfig/${NAME} && . /etc/sysconfig/${NAME}
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
#
test -f ${DAEMON} || exit 5
case "$1" in
start)
echo -n "Starting ${NAME} "
startproc -p ${PID} ${DAEMON}
# Remember status and be verbose
rc_status -v
;;
stop)
echo -n "Stopping ${NAME} "
killproc -p ${PID} ${DAEMON}
# Remember status and be verbose
rc_status -v
# cleanup socket
[ -S /var/run/${NAME}.sock ] && rm -f /var/run/${NAME}.sock
;;
restart)
$0 stop
$0 start
rc_status
;;
reload|force-reload)
echo -n "Reload ${NAME} "
${DAEMON} reload
# Remember status and be verbose
rc_status -v
;;
status)
echo -n "Checking for ${NAME} "
checkproc -p ${PID} ${DAEMON}
# Remember status and be verbose
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|reload|status}"
exit 1
;;
esac
rc_exit