]> andersk Git - gssapi-openssh.git/blame - setup/SXXsshd.in
o Update version number to 1.0.
[gssapi-openssh.git] / setup / SXXsshd.in
CommitLineData
03f5c33a 1#!/bin/sh
4bb7c5ae 2#
e0ceafd7 3# Init file for GSI-OpenSSH server daemon
4bb7c5ae 4#
5# chkconfig: 2345 55 25
e0ceafd7 6# description: GSI-OpenSSH server daemon
4bb7c5ae 7#
03f5c33a 8
20bb6dc8 9GLOBUS_LOCATION="@GLOBUS_LOCATION@"
03f5c33a 10export GLOBUS_LOCATION
11
12. ${GLOBUS_LOCATION}/libexec/globus-script-initializer
13. ${libexecdir}/globus-sh-tools.sh
03f5c33a 14
15PID_FILE=${localstatedir}/sshd.pid
16
812abb17 17#
18# SSHD arguments can be added here within the following
19# set of double quotes.
20#
21
22SSHD_ARGS=""
23
d16626df 24do_start()
25{
26 if [ ! -d $localstatedir ]; then
27 mkdir -p $localstatedir
28 fi
96aba125 29 echo -n "Starting up GSI-OpenSSH sshd server... "
d16626df 30 ${sbindir}/sshd $SSHD_ARGS > /dev/null 2>&1 &
96aba125 31 if [ $? -eq 0 ]; then
32 echo "done."
33 else
34 echo "failed to start GSI-OpenSSH sshd server!"
d16626df 35 fi
36}
37
38do_stop()
39{
96aba125 40 echo -n "Stopping the GSI-OpenSSH sshd server... "
d16626df 41 pid=`cat $PID_FILE`
42 kill -TERM $pid
43 sleep 2
44 kill -TERM $pid 2> /dev/null
45 rm -f $PID_FILE
96aba125 46 echo "done."
d16626df 47}
48
03f5c33a 49case "$1" in
306c7e1a 50 start)
51 if [ ! -f $PID_FILE ]; then
d16626df 52 do_start
306c7e1a 53 else
d16626df 54 pid=`cat $PID_FILE`
55 psout=`ps -A | grep $pid | grep -v grep | awk "{if (\\\$1 == $pid) print}"`
56 if [ "x$psout" = "x" ]; then
96aba125 57 echo "Found stale sshd pid file... removing it."
d16626df 58 rm -f $PID_FILE
59 do_start
60 else
96aba125 61 echo "GSI-OpenSSH sshd server is already running!"
d16626df 62 fi
306c7e1a 63 fi
64 ;;
65
66 stop)
67 if [ -f $PID_FILE ] ; then
d16626df 68 do_stop
96aba125 69 else
70 echo "The server's pid file does not exist! Are you sure the server is running?"
306c7e1a 71 fi
72 ;;
03f5c33a 73
fd95e191 74 restart)
75 $0 stop
76 $0 start
77 ;;
78
79 *)
80 echo "Usage: $0 (start|stop|restart)"
306c7e1a 81 exit 1
03f5c33a 82esac
83
84exit 0
This page took 0.064033 seconds and 5 git commands to generate.