wok view dropbear/stuff/init.d/dropbear @ rev 126

Add : dropbear, isapnptools-*, lzma
author Christophe Lincoln <pankso@slitaz.org>
date Sun Jan 06 14:01:40 2008 +0100 (2008-01-06)
parents
children f4c5b982b05e
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 [ ! -f /etc/dropbear/dropbear_rsa_host_key ] ; then
21 echo "Generating $NAME rsa key... "
22 dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
23 fi
24 if [ ! -f /etc/dropbear/dropbear_dss_host_key ] ; then
25 echo "Generating $NAME dss key... "
26 dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
27 fi
28 if [ -f $PIDFILE ] ; then
29 echo "$NAME already running."
30 exit 1
31 fi
32 echo -n "Starting $DESC: $NAME... "
33 $DAEMON $OPTIONS
34 status
35 ;;
36 stop)
37 if [ ! -f $PIDFILE ] ; then
38 echo "$NAME is not running."
39 exit 1
40 fi
41 echo -n "Stopping $DESC: $NAME... "
42 kill `cat $PIDFILE`
43 status
44 ;;
45 restart)
46 if [ ! -f $PIDFILE ] ; then
47 echo "$NAME is not running."
48 exit 1
49 fi
50 echo -n "Restarting $DESC: $NAME... "
51 kill `cat $PIDFILE`
52 sleep 2
53 $DAEMON $OPTIONS
54 status
55 ;;
56 *)
57 echo ""
58 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
59 echo ""
60 exit 1
61 ;;
62 esac
64 exit 0