]> andersk Git - gssapi-openssh.git/blame - setup/SXXsshd.in
The man2html from jbasney on pkilab2 works whereas the standard one doesn't.
[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
e5c32d4e 9### BEGIN INIT INFO
10# Provides: sshd
11# Required-Start: $network
12# Required-Stop: $network
13# Default-Start: 2 3 4 5
14# Default-Stop: 0 1 6
15# Description: Start the sshd daemon
16### END INIT INFO
17
20bb6dc8 18GLOBUS_LOCATION="@GLOBUS_LOCATION@"
03f5c33a 19export GLOBUS_LOCATION
20
21. ${GLOBUS_LOCATION}/libexec/globus-script-initializer
22. ${libexecdir}/globus-sh-tools.sh
03f5c33a 23
24PID_FILE=${localstatedir}/sshd.pid
0ef83966 25SSHD=${sbindir}/sshd
03f5c33a 26
812abb17 27#
28# SSHD arguments can be added here within the following
29# set of double quotes.
30#
31
32SSHD_ARGS=""
33
d16626df 34do_start()
35{
36 if [ ! -d $localstatedir ]; then
37 mkdir -p $localstatedir
38 fi
0ef83966 39 printf "%s" "Starting up GSI-OpenSSH sshd server... "
40 if [ ! -e $SSHD ]; then
41 echo "failed"
42 echo "$SSHD does not exist."
43 exit 1;
44 fi
45 if [ ! -x $SSHD ]; then
46 echo "failed"
47 echo "$SSHD is not executable."
48 exit 1;
49 fi
50 $SSHD $SSHD_ARGS > /dev/null 2>&1
96aba125 51 if [ $? -eq 0 ]; then
52 echo "done."
53 else
0ef83966 54 echo "failed to start $SSHD!"
d16626df 55 fi
56}
57
58do_stop()
59{
0ef83966 60 printf "%s" "Stopping the GSI-OpenSSH sshd server... "
d16626df 61 pid=`cat $PID_FILE`
62 kill -TERM $pid
63 sleep 2
64 kill -TERM $pid 2> /dev/null
65 rm -f $PID_FILE
96aba125 66 echo "done."
d16626df 67}
68
03f5c33a 69case "$1" in
306c7e1a 70 start)
71 if [ ! -f $PID_FILE ]; then
d16626df 72 do_start
306c7e1a 73 else
d16626df 74 pid=`cat $PID_FILE`
75 psout=`ps -A | grep $pid | grep -v grep | awk "{if (\\\$1 == $pid) print}"`
76 if [ "x$psout" = "x" ]; then
96aba125 77 echo "Found stale sshd pid file... removing it."
d16626df 78 rm -f $PID_FILE
79 do_start
80 else
96aba125 81 echo "GSI-OpenSSH sshd server is already running!"
d16626df 82 fi
306c7e1a 83 fi
84 ;;
85
86 stop)
87 if [ -f $PID_FILE ] ; then
d16626df 88 do_stop
96aba125 89 else
90 echo "The server's pid file does not exist! Are you sure the server is running?"
306c7e1a 91 fi
92 ;;
03f5c33a 93
fd95e191 94 restart)
95 $0 stop
96 $0 start
97 ;;
98
99 *)
100 echo "Usage: $0 (start|stop|restart)"
306c7e1a 101 exit 1
03f5c33a 102esac
103
104exit 0
This page took 0.06797 seconds and 5 git commands to generate.