wok-current view dropbear/stuff/init.d/dropbear @ rev 6823

Add fftw: mv from undigest
author Rohit Joshi <jozee@slitaz.org>
date Tue Oct 19 21:04:01 2010 -0400 (2010-10-19)
parents c8fcc267ac25
children 7f188676b59c
line source
1 #!/bin/sh
2 # /etc/init.d/dropbear : Start, stop and restart SSH server on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start SSH server at boot time, just put dropbear in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=Dropbear
12 DESC="SSH server"
13 DAEMON=/usr/sbin/dropbear
14 OPTIONS=$DROPBEAR_OPTIONS
15 PIDFILE=/var/run/dropbear.pid
17 case "$1" in
18 start)
19 # We need rsa and dss host key file to start dropbear.
20 if [ ! -s /etc/dropbear/dropbear_rsa_host_key ] ; then
21 echo -n "Generating $NAME rsa key... "
22 # Need to delete key before creating it.
23 rm -f /etc/dropbear/dropbear_rsa_host_key
24 dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key > /dev/null 2>&1
25 status
26 fi
27 if [ ! -s /etc/dropbear/dropbear_dss_host_key ] ; then
28 echo -n "Generating $NAME dss key... "
29 # Need to delete key before creating it.
30 rm -f /etc/dropbear/dropbear_dss_host_key
31 dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key > /dev/null 2>&1
32 status
33 fi
34 if active_pidfile $PIDFILE dropbear ; then
35 echo "$NAME already running."
36 exit 1
37 fi
38 echo -n "Starting $DESC: $NAME... "
39 $DAEMON $OPTIONS
40 status
41 ;;
42 stop)
43 if ! active_pidfile $PIDFILE dropbear ; then
44 echo "$NAME is not running."
45 exit 1
46 fi
47 echo -n "Stopping $DESC: $NAME... "
48 kill `cat $PIDFILE`
49 status
50 ;;
51 restart)
52 if ! active_pidfile $PIDFILE dropbear ; then
53 echo "$NAME is not running."
54 exit 1
55 fi
56 echo -n "Restarting $DESC: $NAME... "
57 kill `cat $PIDFILE`
58 sleep 2
59 $DAEMON $OPTIONS
60 status
61 ;;
62 *)
63 echo ""
64 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
65 echo ""
66 exit 1
67 ;;
68 esac
70 exit 0