diff options
Diffstat (limited to 'other/ssharp/contrib/solaris/sshd-initscript.in')
| -rwxr-xr-x | other/ssharp/contrib/solaris/sshd-initscript.in | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/other/ssharp/contrib/solaris/sshd-initscript.in b/other/ssharp/contrib/solaris/sshd-initscript.in new file mode 100755 index 0000000..886a51f --- /dev/null +++ b/other/ssharp/contrib/solaris/sshd-initscript.in | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | #! /sbin/sh | ||
| 2 | |||
| 3 | # SSHd startup/shutdown script, based on uucp script. | ||
| 4 | |||
| 5 | PIDFILE="%%PIDDIR%%/sshd.pid" | ||
| 6 | PGREP="/usr/bin/pgrep" | ||
| 7 | HEAD="/usr/bin/head" | ||
| 8 | XARGS="/usr/bin/xargs" | ||
| 9 | KILL="/usr/bin/kill" | ||
| 10 | |||
| 11 | killproc() { | ||
| 12 | _procname=$1 | ||
| 13 | _signal=$2 | ||
| 14 | ${PGREP} ${_procname} | ${HEAD} -1 | ${XARGS} -t -I {} ${KILL} -${_signal} {} | ||
| 15 | } | ||
| 16 | |||
| 17 | case $1 in | ||
| 18 | 'start') | ||
| 19 | /usr/local/sbin/sshd | ||
| 20 | ;; | ||
| 21 | |||
| 22 | 'stop') | ||
| 23 | if [ -r $PIDFILE -a ! -z ${PIDFILE} ]; then | ||
| 24 | PID=`cat ${PIDFILE}` | ||
| 25 | fi | ||
| 26 | if [ ${PID:=0} -gt 1 -a ! "X$PID" = "X " ]; then | ||
| 27 | /usr/bin/kill $PID | ||
| 28 | else | ||
| 29 | echo "Unable to read PID file, killing using alternate method" | ||
| 30 | killproc sshd TERM | ||
| 31 | fi | ||
| 32 | ;; | ||
| 33 | |||
| 34 | 'restart') | ||
| 35 | if [ -r $PIDFILE -a ! -z ${PIDFILE} ]; then | ||
| 36 | PID=`cat ${PIDFILE}` | ||
| 37 | fi | ||
| 38 | if [ ${PID:=0} -gt 1 -a ! "X$PID" = "X " ]; then | ||
| 39 | /usr/bin/kill -HUP $PID | ||
| 40 | else | ||
| 41 | echo "Unable to read PID file, trying alternate method" | ||
| 42 | killproc sshd HUP | ||
| 43 | /usr/local/sbin/sshd | ||
| 44 | fi | ||
| 45 | ;; | ||
| 46 | |||
| 47 | *) | ||
| 48 | echo "usage: /etc/init.d/sshd {start|stop|restart}" | ||
| 49 | ;; | ||
| 50 | esac | ||
