]> andersk Git - gssapi-openssh.git/blame - openssh/opensshd.init.in
Merge from OPENSSH_3_8_1P1_GSSAPI_20040713 to OPENSSH_3_9P1_GSSAPI_20040818.
[gssapi-openssh.git] / openssh / opensshd.init.in
CommitLineData
3c0ef626 1#!/sbin/sh
2# Donated code that was put under PD license.
3#
4# Stripped PRNGd out of it for the time being.
5
1c14df9e 6umask 022
7
1b56ff3d 8CAT=@CAT@
9KILL=@KILL@
3c0ef626 10
1b56ff3d 11prefix=@prefix@
12sysconfdir=@sysconfdir@
13piddir=@piddir@
3c0ef626 14
15SSHD=$prefix/sbin/sshd
16PIDFILE=$piddir/sshd.pid
17SSH_KEYGEN=$prefix/bin/ssh-keygen
1b56ff3d 18HOST_KEY_RSA1=$sysconfdir/ssh_host_key
19HOST_KEY_DSA=$sysconfdir/ssh_host_dsa_key
20HOST_KEY_RSA=$sysconfdir/ssh_host_rsa_key
3c0ef626 21
3c0ef626 22
23checkkeys() {
24 if [ ! -f $HOST_KEY_RSA1 ]; then
416fd2a8 25 ${SSH_KEYGEN} -t rsa1 -f ${HOST_KEY_RSA1} -N ""
3c0ef626 26 fi
27 if [ ! -f $HOST_KEY_DSA ]; then
416fd2a8 28 ${SSH_KEYGEN} -t dsa -f ${HOST_KEY_DSA} -N ""
3c0ef626 29 fi
30 if [ ! -f $HOST_KEY_RSA ]; then
416fd2a8 31 ${SSH_KEYGEN} -t rsa -f ${HOST_KEY_RSA} -N ""
3c0ef626 32 fi
33}
34
35stop_service() {
36 if [ -r $PIDFILE -a ! -z ${PIDFILE} ]; then
416fd2a8 37 PID=`${CAT} ${PIDFILE}`
3c0ef626 38 fi
39 if [ ${PID:=0} -gt 1 -a ! "X$PID" = "X " ]; then
416fd2a8 40 ${KILL} ${PID}
3c0ef626 41 else
416fd2a8 42 echo "Unable to read PID file"
3c0ef626 43 fi
44}
45
46start_service() {
47 # XXX We really should check if the service is already going, but
48 # XXX we will opt out at this time. - Bal
49
50 # Check to see if we have keys that need to be made
51 checkkeys
52
53 # Start SSHD
54 echo "starting $SSHD... \c" ; $SSHD
55
56 sshd_rc=$?
57 if [ $sshd_rc -ne 0 ]; then
416fd2a8 58 echo "$0: Error ${sshd_rc} starting ${SSHD}... bailing."
59 exit $sshd_rc
3c0ef626 60 fi
61 echo done.
62}
63
64case $1 in
65
66'start')
67 start_service
68 ;;
69
70'stop')
71 stop_service
72 ;;
73
74'restart')
75 stop_service
76 start_service
77 ;;
78
79*)
80 echo "$0: usage: $0 {start|stop|restart}"
81 ;;
82esac
This page took 0.070005 seconds and 5 git commands to generate.