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