Created
June 12, 2014 06:18
-
-
Save azilber/430dbe1ca50724d70f54 to your computer and use it in GitHub Desktop.
Revisions
-
azilber created this gist
Jun 12, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,70 @@ #!/bin/sh # # chkconfig: 345 99 1 # description: Start and stop script for sshutout # ### BEGIN INIT INFO # Provides: sshutout # Required-Start: $local_fs $network +splash_late # Required-Stop: # Default-Start: 3 4 5 # Default-Stop: 0 1 2 6 # Short-Description: sshutout security # Description: sshutout ### END INIT INFO # SSHOUT_RUNNING=1 chk_running() { if [ "x$SSHOUT_PID" != "x" ] then ps -p $SSHOUT_PID >/dev/null 2>&1 if [ $? -eq 0 ] then SSHOUT_RUNNING=1 else SSHOUT_RUNNING=0 fi else SSHOUT_RUNNING=0 fi } OP=${1:-"start"} case "$OP" in start) echo "Starting sshutout:" /usr/local/sbin/sshutout if [ -d /var/lock/subsys ] then touch /var/lock/subsys/sshutout fi echo ;; stop) echo "Stopping sshutout:" if [ -f "/var/run/sshutout.pid" ] then SSHOUT_PID=`cat /var/run/sshutout.pid` kill $SSHOUT_PID fi while [ $SSHOUT_RUNNING -eq 1 ] do echo " waiting for program termination..." sleep 5 chk_running done rm -f /var/lock/subsys/sshutout echo ;; restart) $0 stop sleep 5 $0 start ;; *) echo "Usage $0 {start stop restart}" exit 1 ;; esac exit 0