mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-21 19:42:24 +01:00
42 lines
577 B
Text
42 lines
577 B
Text
|
#!/bin/sh
|
||
|
# Start/stop/restart knockd.
|
||
|
|
||
|
# Start knockd:
|
||
|
knockd_start() {
|
||
|
CMDLINE="/usr/sbin/knockd -d"
|
||
|
echo -n "Starting knock daemon: $CMDLINE "
|
||
|
$CMDLINE
|
||
|
echo
|
||
|
}
|
||
|
|
||
|
# Stop knockd:
|
||
|
knockd_stop() {
|
||
|
echo -n "Stopping knock daemon..."
|
||
|
kill `cat /var/run/knockd.pid`
|
||
|
echo
|
||
|
sleep 1
|
||
|
rm -f /var/run/knockd.pid
|
||
|
killall knockd 2> /dev/null
|
||
|
}
|
||
|
|
||
|
# Restart knockd:
|
||
|
knockd_restart() {
|
||
|
knockd_stop
|
||
|
sleep 1
|
||
|
knockd_start
|
||
|
}
|
||
|
|
||
|
case "$1" in
|
||
|
'start')
|
||
|
knockd_start
|
||
|
;;
|
||
|
'stop')
|
||
|
knockd_stop
|
||
|
;;
|
||
|
'restart')
|
||
|
knockd_restart
|
||
|
;;
|
||
|
*)
|
||
|
echo "usage $0 start|stop|restart"
|
||
|
esac
|