wok annotate 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
rev   line source
pascal@860 1 #!/bin/sh
al@18689 2 # /etc/init.d/openssh : Start, stop and restart OpenSSH server on SliTaz, at
pascal@860 3 # boot time or with the command line.
pascal@860 4 #
pascal@860 5 # To start OpenSSH server at boot time, just put openssh in the $RUN_DAEMONS
pascal@860 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
pascal@860 7 #
pascal@860 8 . /etc/init.d/rc.functions
pascal@860 9 . /etc/daemons.conf
pascal@860 10
pascal@860 11 NAME=OpenSSH
al@19159 12 DESC="$(_ '%s server' OpenSSH)"
pascal@860 13 DAEMON=/usr/sbin/sshd
pascal@860 14 OPTIONS=$OPENSSH_OPTIONS
pascal@860 15 PIDFILE=/var/run/sshd.pid
pascal@860 16
pascal@16681 17 [ -d /var/run/sshd ] || mkdir -p /var/run/sshd
al@18689 18
pascal@860 19 case "$1" in
al@18689 20 start)
al@18689 21 # We need rsa and dsa host key file to start dropbear.
al@18689 22 if [ ! -f /etc/ssh/ssh_host_rsa_key ] ; then
al@19159 23 _ 'Generating OpenSSH %s key... ' rsa
al@18689 24 ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -C '' -N ''
al@18689 25 fi
al@18689 26 if [ ! -f /etc/ssh/ssh_host_dsa_key ] ; then
al@19159 27 _ 'Generating OpenSSH %s key... ' dsa
al@18689 28 ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -C '' -N ''
al@18689 29 fi
al@18689 30 if [ ! -f /etc/ssh/ssh_host_ecdsa_key ] ; then
al@19159 31 _ 'Generating OpenSSH %s key... ' ecdsa
al@18689 32 ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -C '' -N ''
al@18689 33 fi
al@18689 34 if active_pidfile $PIDFILE sshd ; then
al@19159 35 _ '%s is already running.' $NAME
al@18689 36 exit 1
al@18689 37 fi
al@19159 38 action 'Starting %s: %s...' "$DESC" $NAME
al@18689 39 $DAEMON $OPTIONS
al@18689 40 status
al@18689 41 ;;
al@18689 42 stop)
al@18689 43 if ! active_pidfile $PIDFILE sshd ; then
al@19159 44 _ '%s is not running.' $NAME
al@18689 45 exit 1
al@18689 46 fi
al@19159 47 action 'Stopping %s: %s...' "$DESC" $NAME
al@18689 48 kill $(cat $PIDFILE)
al@18689 49 status
al@18689 50 ;;
al@18689 51 restart)
al@18689 52 if ! active_pidfile $PIDFILE sshd ; then
al@19159 53 _ '%s is not running.' $NAME
al@18689 54 exit 1
al@18689 55 fi
al@19159 56 action 'Restarting %s: %s...' "$DESC" $NAME
al@18689 57 kill $(cat $PIDFILE)
al@18689 58 sleep 2
al@18689 59 $DAEMON $OPTIONS
al@18689 60 status
al@18689 61 ;;
al@18689 62 *)
al@19159 63 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
al@18689 64 newline
al@18689 65 exit 1
al@18689 66 ;;
pascal@860 67 esac
pascal@860 68
pascal@860 69 exit 0