-
Notifications
You must be signed in to change notification settings - Fork 0
Init script
HeisSpiter edited this page May 12, 2012
·
1 revision
Possible init script (to place in /etc/init.d) to use ForbidHostsv6 as service. It provides: start, stop, restart, status.
#!/bin/sh
### BEGIN INIT INFO
# Provides: forbidhostsv6
# Required-Start: $syslog $local_fs $time
# Required-Stop: $syslog $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: forbidhostsv6
# Description: SSH IPv6 connections check
### END INIT INFO
. /lib/lsb/init-functions
[ -f /etc/default/rcS ] && . /etc/default/rcS
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin
PROGRAM=/usr/local/sbin/ForbidHostsv6
test -x $PROGRAM || exit 0
case "$1" in
start)
COUNT=`pgrep -c ForbidHostsv6`
[ "x$COUNT" != "x0" ] && exit 0
$PROGRAM
exit 0
;;
stop)
pkill -15 ForbidHostsv6
exit 0
;;
force-reload|restart)
$0 stop
$0 start
;;
status)
COUNT=`pgrep -c ForbidHostsv6`
if [ "x$COUNT" != "x0" ]; then
echo "Running"
else
echo "Not running"
fi
exit 0
;;
*)
echo "Usage: /etc/init.d/forbidhostsv6 {start|stop|restart|force-reload|status}"
exit 1
esac
exit 0