wok annotate dropbear/stuff/init.d/dropbear @ rev 12254

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