wok annotate openssh/stuff/openssh @ rev 12431
ekiga: update bdeps
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Apr 21 17:25:54 2012 +0200 (2012-04-21) |
parents | 1b6281d68d9f |
children | 0d8a1a3edc72 |
rev | line source |
---|---|
pascal@860 | 1 #!/bin/sh |
pascal@860 | 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@860 | 17 case "$1" in |
pascal@860 | 18 start) |
pascal@860 | 19 # We need rsa and dsa host key file to start dropbear. |
pascal@860 | 20 if [ ! -f /etc/ssh/ssh_host_rsa_key ] ; then |
pascal@860 | 21 echo "Generating $NAME rsa key... " |
pascal@860 | 22 ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -C '' -N '' |
pascal@860 | 23 fi |
pascal@860 | 24 if [ ! -f /etc/ssh/ssh_host_dsa_key ] ; then |
pascal@860 | 25 echo "Generating $NAME dsa key... " |
pascal@860 | 26 ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -C '' -N '' |
pascal@860 | 27 fi |
erjo@11999 | 28 if [ ! -f /etc/ssh/ssh_host_ecdsa_key ] ; then |
erjo@11999 | 29 echo "Generating $NAME ecdsa key... " |
erjo@11999 | 30 ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -C '' -N '' |
erjo@11999 | 31 fi |
pascal@6170 | 32 if active_pidfile $PIDFILE sshd ; then |
pascal@860 | 33 echo "$NAME already running." |
pascal@860 | 34 exit 1 |
pascal@860 | 35 fi |
pascal@860 | 36 echo -n "Starting $DESC: $NAME... " |
pascal@860 | 37 $DAEMON $OPTIONS |
pascal@860 | 38 status |
pascal@860 | 39 ;; |
pascal@860 | 40 stop) |
pascal@6170 | 41 if ! active_pidfile $PIDFILE sshd ; then |
pascal@860 | 42 echo "$NAME is not running." |
pascal@860 | 43 exit 1 |
pascal@860 | 44 fi |
pascal@860 | 45 echo -n "Stopping $DESC: $NAME... " |
pascal@860 | 46 kill `cat $PIDFILE` |
pascal@860 | 47 status |
pascal@860 | 48 ;; |
pascal@860 | 49 restart) |
pascal@6170 | 50 if ! active_pidfile $PIDFILE sshd ; then |
pascal@860 | 51 echo "$NAME is not running." |
pascal@860 | 52 exit 1 |
pascal@860 | 53 fi |
pascal@860 | 54 echo -n "Restarting $DESC: $NAME... " |
pascal@860 | 55 kill `cat $PIDFILE` |
pascal@860 | 56 sleep 2 |
pascal@860 | 57 $DAEMON $OPTIONS |
pascal@860 | 58 status |
pascal@860 | 59 ;; |
pascal@860 | 60 *) |
pascal@860 | 61 echo "" |
pascal@860 | 62 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
pascal@860 | 63 echo "" |
pascal@860 | 64 exit 1 |
pascal@860 | 65 ;; |
pascal@860 | 66 esac |
pascal@860 | 67 |
pascal@860 | 68 exit 0 |