wok annotate openssh/stuff/openssh @ rev 18745

linux*zram: add CONFIG_FILES (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Dec 25 21:45:26 2015 +0100 (2015-12-25)
parents 0d8a1a3edc72
children 7f188676b59c
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
pascal@860 12 DESC="OpenSSH server"
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@18689 23 echo "Generating $NAME rsa key... "
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@18689 27 echo "Generating $NAME dsa key... "
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@18689 31 echo "Generating $NAME ecdsa key... "
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@18689 35 echo "$NAME already running."
al@18689 36 exit 1
al@18689 37 fi
al@18689 38 action "Starting $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@18689 44 echo "$NAME is not running."
al@18689 45 exit 1
al@18689 46 fi
al@18689 47 action "Stopping $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@18689 53 echo "$NAME is not running."
al@18689 54 exit 1
al@18689 55 fi
al@18689 56 action "Restarting $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@18689 63 emsg "<n><b>Usage:</b> /etc/init.d/$(basename $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