Magellan Linux

Annotation of /trunk/dropbear/dropbear.rc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 452 - (hide annotations) (download)
Tue Jan 22 23:29:12 2008 UTC (16 years, 3 months ago) by niro
File size: 1212 byte(s)
-rc-script for dropbear

1 niro 452 #!/bin/bash
2     # $Header: /root/magellan-cvs/src/dropbear/dropbear.rc,v 1.1 2008-01-22 23:29:12 niro Exp $
3    
4     #%rlevels: 3:s 4:s 5:s 0:k 1:k 2:k 6:k
5     #%start: 30
6     #%stop: 30
7    
8     #deps
9     #%needs:
10     #%before:
11     #%after:
12    
13     source /etc/sysconfig/rc
14     source $rc_functions
15    
16     gen_keys()
17     {
18     if [ ! -e /etc/dropbear/dropbear_dss_host_key ]
19     then
20     echo -e ${COLOREDSTAR}"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     echo -e ${COLOREDSTAR}"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     echo -e ${COLOREDSTAR}"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     echo -e ${COLOREDSTAR}"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     echo "Usage: $0 {start|stop|restart|status}"
63     exit 1
64     ;;
65     esac