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

pulseaudio: fix/up 8.0
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Mar 23 15:16:20 2017 +0200 (2017-03-23)
parents 7f188676b59c
children 6a8b83dd1456
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="$(_ '%s server' SSH)"
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 action 'Generating Dropbear %s key...' RSA
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 action 'Generating Dropbear %s key...' DSS
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 [ ! -s /etc/dropbear/dropbear_ecdsa_host_key ] ; then
35 action 'Generating Dropbear %s key...' ECDSA
36 # Need to delete key before creating it.
37 rm -f /etc/dropbear/dropbear_ecdsa_host_key
38 dropbearkey -t ecdsa -f /etc/dropbear/dropbear_ecdsa_host_key >/dev/null 2>&1
39 status
40 fi
41 if active_pidfile $PIDFILE dropbear ; then
42 _ '%s is already running.' $NAME
43 exit 1
44 fi
45 action 'Starting %s: %s...' "$DESC" $NAME
46 $DAEMON $OPTIONS
47 status
48 ;;
49 stop)
50 if ! active_pidfile $PIDFILE dropbear ; then
51 _ '%s is not running.' $NAME
52 exit 1
53 fi
54 action 'Stopping %s: %s...' "$DESC" $NAME
55 kill $(cat $PIDFILE)
56 status
57 ;;
58 restart)
59 if ! active_pidfile $PIDFILE dropbear ; then
60 _ '%s is not running.' $NAME
61 exit 1
62 fi
63 action 'Restarting %s: %s...' "$DESC" $NAME
64 kill $(cat $PIDFILE)
65 sleep 2
66 $DAEMON $OPTIONS
67 status
68 ;;
69 *)
70 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
71 newline
72 exit 1
73 ;;
74 esac
76 exit 0