wok view openssh/stuff/openssh @ rev 19480

Add slitaz-icons-paper
author Aleksej Bobylev <al.bobylev@gmail.com>
date Tue Nov 01 04:07:59 2016 +0200 (2016-11-01)
parents e2e3be9972fa
children 6a8b83dd1456
line source
1 #!/bin/sh
2 # /etc/init.d/openssh : Start, stop and restart OpenSSH server on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start OpenSSH server at boot time, just put openssh 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=OpenSSH
12 DESC="$(_ '%s server' OpenSSH)"
13 DAEMON=/usr/sbin/sshd
14 OPTIONS=$OPENSSH_OPTIONS
15 PIDFILE=/var/run/sshd.pid
17 [ -d /var/run/sshd ] || mkdir -p /var/run/sshd
19 case "$1" in
20 start)
21 # We need rsa and dsa host key file to start dropbear.
22 if [ ! -f /etc/ssh/ssh_host_rsa_key ] ; then
23 _ 'Generating OpenSSH %s key... ' rsa
24 ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -C '' -N ''
25 fi
26 if [ ! -f /etc/ssh/ssh_host_dsa_key ] ; then
27 _ 'Generating OpenSSH %s key... ' dsa
28 ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -C '' -N ''
29 fi
30 if [ ! -f /etc/ssh/ssh_host_ecdsa_key ] ; then
31 _ 'Generating OpenSSH %s key... ' ecdsa
32 ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -C '' -N ''
33 fi
34 if active_pidfile $PIDFILE sshd ; then
35 _ '%s is already running.' $NAME
36 exit 1
37 fi
38 action 'Starting %s: %s...' "$DESC" $NAME
39 $DAEMON $OPTIONS
40 status
41 ;;
42 stop)
43 if ! active_pidfile $PIDFILE sshd ; then
44 _ '%s is not running.' $NAME
45 exit 1
46 fi
47 action 'Stopping %s: %s...' "$DESC" $NAME
48 kill $(cat $PIDFILE)
49 status
50 ;;
51 restart)
52 if ! active_pidfile $PIDFILE sshd ; then
53 _ '%s is not running.' $NAME
54 exit 1
55 fi
56 action 'Restarting %s: %s...' "$DESC" $NAME
57 kill $(cat $PIDFILE)
58 sleep 2
59 $DAEMON $OPTIONS
60 status
61 ;;
62 *)
63 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
64 newline
65 exit 1
66 ;;
67 esac
69 exit 0