Magellan Linux

Contents of /trunk/dropbear/dropbear.rc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2128 - (show annotations) (download)
Wed Mar 20 08:51:51 2013 UTC (11 years, 1 month ago) by niro
File size: 1142 byte(s)
-use rc_echo() and rc_print()
1 #!/bin/bash
2 # $Header: /root/magellan-cvs/src/dropbear/dropbear.rc,v 1.2 2008-06-10 22:19:25 niro Exp $
3
4 #%rlevels: 3:s 0:k
5 #%start: 30
6 #%stop: 30
7
8 #deps
9 #%needs:
10 #%before:
11 #%after:
12
13 source /etc/conf.d/rc
14 source ${rc_functions}
15
16 gen_keys()
17 {
18 if [ ! -e /etc/dropbear/dropbear_dss_host_key ]
19 then
20 rc_print "Generating DSS-Hostkey ..."
21 /usr/bin/dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
22 fi
23
24 if [ ! -e /etc/dropbear/dropbear_rsa_host_key ]
25 then
26 rc_print "Generating RSA-Hostkey ..."
27 /usr/bin/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
28 fi
29 }
30
31 case "$1" in
32 start)
33 gen_keys
34 rc_print "Starting Dropbear SSH Server ..."
35 /usr/sbin/dropbear
36 evaluate_retval
37
38 update_svcstatus $1
39 splash svc_started "$(basename $0)" 0
40 ;;
41
42 stop)
43 rc_print "Stopping Dropbear SSH Server ..."
44 start-stop-daemon --stop --quiet --pidfile /var/run/dropbear.pid
45 evaluate_retval
46
47 update_svcstatus $1
48 splash svc_stopped "$(basename $0)" 0
49 ;;
50
51 restart)
52 $0 stop
53 sleep 1
54 $0 start
55 ;;
56
57 status)
58 statusproc /usr/sbin/dropbear
59 ;;
60
61 *)
62 rc_echo "Usage: $0 {start|stop|restart|status}"
63 exit 1
64 ;;
65 esac