]> andersk Git - gssapi-openssh.git/blame - openssh/gpt/setup/SXXsshd.in
More fixes for strict C compliation.
[gssapi-openssh.git] / openssh / gpt / setup / SXXsshd.in
CommitLineData
2f855b40 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### 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
18GLOBUS_LOCATION="@GLOBUS_LOCATION@"
19export GLOBUS_LOCATION
20
21. ${GLOBUS_LOCATION}/libexec/globus-script-initializer
22. ${libexecdir}/globus-sh-tools.sh
23
24PID_FILE=${localstatedir}/sshd.pid
25
26#
27# SSHD arguments can be added here within the following
28# set of double quotes.
29#
30
31SSHD_ARGS=""
32
33do_start()
34{
35 if [ ! -d $localstatedir ]; then
36 mkdir -p $localstatedir
37 fi
38 echo -n "Starting up GSI-OpenSSH sshd server... "
39 ${sbindir}/sshd $SSHD_ARGS > /dev/null 2>&1 &
40 if [ $? -eq 0 ]; then
41 echo "done."
42 else
43 echo "failed to start GSI-OpenSSH sshd server!"
44 fi
45}
46
47do_stop()
48{
49 echo -n "Stopping the GSI-OpenSSH sshd server... "
50 pid=`cat $PID_FILE`
51 kill -TERM $pid
52 sleep 2
53 kill -TERM $pid 2> /dev/null
54 rm -f $PID_FILE
55 echo "done."
56}
57
58case "$1" in
59 start)
60 if [ ! -f $PID_FILE ]; then
61 do_start
62 else
63 pid=`cat $PID_FILE`
64 psout=`ps -A | grep $pid | grep -v grep | awk "{if (\\\$1 == $pid) print}"`
65 if [ "x$psout" = "x" ]; then
66 echo "Found stale sshd pid file... removing it."
67 rm -f $PID_FILE
68 do_start
69 else
70 echo "GSI-OpenSSH sshd server is already running!"
71 fi
72 fi
73 ;;
74
75 stop)
76 if [ -f $PID_FILE ] ; then
77 do_stop
78 else
79 echo "The server's pid file does not exist! Are you sure the server is running?"
80 fi
81 ;;
82
83 restart)
84 $0 stop
85 $0 start
86 ;;
87
88 *)
89 echo "Usage: $0 (start|stop|restart)"
90 exit 1
91esac
92
93exit 0
This page took 1.135296 seconds and 5 git commands to generate.