wok annotate openssh/stuff/openssh @ rev 5195
slitaz-doc: fix version for 3.0
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sun Mar 28 17:16:33 2010 +0200 (2010-03-28) |
parents | |
children | 1b6281d68d9f |
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 |
pascal@860 | 28 if [ -f $PIDFILE ] ; then |
pascal@860 | 29 echo "$NAME already running." |
pascal@860 | 30 exit 1 |
pascal@860 | 31 fi |
pascal@860 | 32 echo -n "Starting $DESC: $NAME... " |
pascal@860 | 33 $DAEMON $OPTIONS |
pascal@860 | 34 status |
pascal@860 | 35 ;; |
pascal@860 | 36 stop) |
pascal@860 | 37 if [ ! -f $PIDFILE ] ; then |
pascal@860 | 38 echo "$NAME is not running." |
pascal@860 | 39 exit 1 |
pascal@860 | 40 fi |
pascal@860 | 41 echo -n "Stopping $DESC: $NAME... " |
pascal@860 | 42 kill `cat $PIDFILE` |
pascal@860 | 43 status |
pascal@860 | 44 ;; |
pascal@860 | 45 restart) |
pascal@860 | 46 if [ ! -f $PIDFILE ] ; then |
pascal@860 | 47 echo "$NAME is not running." |
pascal@860 | 48 exit 1 |
pascal@860 | 49 fi |
pascal@860 | 50 echo -n "Restarting $DESC: $NAME... " |
pascal@860 | 51 kill `cat $PIDFILE` |
pascal@860 | 52 sleep 2 |
pascal@860 | 53 $DAEMON $OPTIONS |
pascal@860 | 54 status |
pascal@860 | 55 ;; |
pascal@860 | 56 *) |
pascal@860 | 57 echo "" |
pascal@860 | 58 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
pascal@860 | 59 echo "" |
pascal@860 | 60 exit 1 |
pascal@860 | 61 ;; |
pascal@860 | 62 esac |
pascal@860 | 63 |
pascal@860 | 64 exit 0 |