This commit is contained in:
103
knockd.init
Normal file
103
knockd.init
Normal file
@@ -0,0 +1,103 @@
|
||||
#! /bin/sh
|
||||
# Copyright (c) 1997-2006 SUSE Linux AG, Nuernberg, Germany.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Author: Henne Vogelsang
|
||||
# Please send feedback to http://www.suse.de/feedback/
|
||||
#
|
||||
# /etc/init.d/knockd
|
||||
# and its symbolic link
|
||||
# /usr/sbin/rcknockd
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: knockd
|
||||
# Required-Start: $syslog $remote_fs $network
|
||||
# Required-Stop: $syslog $remote_fs
|
||||
# Default-Start: 3 5
|
||||
# Default-Stop: 0 1 2 6
|
||||
# Short-Description: knock daemon providing port-knocking
|
||||
# Description: Start knockd to allow port-knocking
|
||||
### END INIT INFO
|
||||
|
||||
# Check for missing binaries (stale symlinks should not happen)
|
||||
# Note: Special treatment of stop for LSB conformance
|
||||
KNOCKD_BIN=/usr/sbin/knockd
|
||||
test -x $KNOCKD_BIN || { echo "$KNOCKD_BIN not installed";
|
||||
if [ "$1" = "stop" ]; then exit 0;
|
||||
else exit 5; fi; }
|
||||
|
||||
# Check for existence of needed config file and read it
|
||||
KNOCKD_CONFIG=/etc/sysconfig/knockd
|
||||
test -r $KNOCKD_CONFIG || { echo "$KNOCKD_CONFIG not existing";
|
||||
if [ "$1" = "stop" ]; then exit 0;
|
||||
else exit 6; fi; }
|
||||
|
||||
# Read config
|
||||
. $KNOCKD_CONFIG
|
||||
|
||||
# Shell functions sourced from /etc/rc.status:
|
||||
. /etc/rc.status
|
||||
|
||||
# Reset status of this service
|
||||
rc_reset
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting knockd "
|
||||
startproc $KNOCKD_BIN $KNOCKD_OPTIONS
|
||||
rc_status -v
|
||||
;;
|
||||
stop)
|
||||
echo -n "Shutting down knockd "
|
||||
killproc -TERM $KNOCKD_BIN
|
||||
rc_status -v
|
||||
;;
|
||||
try-restart)
|
||||
$0 status
|
||||
if test $? = 0; then
|
||||
$0 restart
|
||||
else
|
||||
rc_reset
|
||||
fi
|
||||
rc_status
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
rc_status
|
||||
;;
|
||||
force-reload)
|
||||
echo -n "Reload service KNOCKD "
|
||||
killproc -HUP $KNOCKD_BIN
|
||||
rc_status -v
|
||||
;;
|
||||
reload)
|
||||
echo -n "Reload service KNOCKD "
|
||||
killproc -HUP $KNOCKD_BIN
|
||||
rc_status -v
|
||||
;;
|
||||
status)
|
||||
echo -n "Checking for service KNOCKD "
|
||||
checkproc $KNOCKD_BIN
|
||||
rc_status -v
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
rc_exit
|
Reference in New Issue
Block a user