Magellan Linux

Contents of /trunk/magellan-initscripts/etc/rc.d/init.d/sshd

Parent Directory Parent Directory | Revision Log Revision Log


Revision 21 - (show annotations) (download)
Fri Dec 31 18:41:48 2004 UTC (19 years, 3 months ago) by niro
File size: 1364 byte(s)
fixed startup of the ssh-daemon

1 #!/bin/bash
2
3 #%rlevels: 3:s 4:s 5:s 0:k 1:k 2:k 6:k
4 #%start: 30
5 #%stop: 30
6
7 #deps
8 #%needs:
9 #%before:
10 #%after:
11
12 source /etc/sysconfig/rc
13 source $rc_functions
14
15 gen_keys() {
16 if [ ! -e /etc/ssh/ssh_host_key ]
17 then
18 echo -e ${COLOREDSTAR}"Generating SSH-Hostkey ..."
19 /usr/bin/ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N ''
20 fi
21
22 if [ ! -e /etc/ssh/ssh_host_dsa_key ]
23 then
24 echo -e ${COLREDSTAR}"Generating DSA-Hostkey ..."
25 /usr/bin/ssh-keygen -d -f /etc/ssh/ssh_host_dsa_key -N ''
26 fi
27
28 if [ ! -e /etc/ssh/ssh_host_rsa_key ]
29 then
30 echo -e ${COLOREDSTAR}"Generating RSA-Hostkey ..."
31 /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
32 fi
33 }
34
35 case "$1" in
36 start)
37 gen_keys
38 echo -e ${COLOREDSTAR}"Starting SSH Server ..."
39 start-stop-daemon --start --quiet --pidfile /var/run/sshd.pid \
40 --startas /usr/sbin/sshd
41 update_svcstatus $1
42 splash svc_started "$(basename $0)" 0
43 ;;
44
45 stop)
46 echo -e ${COLOREDSTAR}"Stopping SSH Server ..."
47 start-stop-daemon --stop --quiet --pidfile /var/run/sshd.pid
48
49 update_svcstatus $1
50 splash svc_stopped "$(basename $0)" 0
51 ;;
52
53 reload)
54 echo -e ${COLOREDSTAR}"Reloading SSH Server ..."
55 reloadproc /usr/sbin/sshd
56 ;;
57
58 restart)
59 $0 stop
60 sleep 1
61 $0 start
62 ;;
63
64 status)
65 statusproc /usr/sbin/sshd
66 ;;
67
68 *)
69 echo "Usage: $0 {start|stop|reload|restart|status}"
70 exit 1
71 ;;
72 esac

Properties

Name Value
svn:executable *