wok-next annotate openssh-pam/stuff/openssh @ rev 2213
openssh*: --libexecdir=/usr/sbin (no /usr/libexec)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Wed Feb 11 17:41:17 2009 +0100 (2009-02-11) |
parents | |
children |
rev | line source |
---|---|
pascal@2188 | 1 #!/bin/sh |
pascal@2188 | 2 # /etc/init.d/openssh : Start, stop and restart OpenSSH server on SliTaz, at |
pascal@2188 | 3 # boot time or with the command line. |
pascal@2188 | 4 # |
pascal@2188 | 5 # To start OpenSSH server at boot time, just put openssh in the $RUN_DAEMONS |
pascal@2188 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf |
pascal@2188 | 7 # |
pascal@2188 | 8 . /etc/init.d/rc.functions |
pascal@2188 | 9 . /etc/daemons.conf |
pascal@2188 | 10 |
pascal@2188 | 11 NAME=OpenSSH |
pascal@2188 | 12 DESC="OpenSSH server" |
pascal@2188 | 13 DAEMON=/usr/sbin/sshd |
pascal@2188 | 14 OPTIONS=$OPENSSH_OPTIONS |
pascal@2188 | 15 PIDFILE=/var/run/sshd.pid |
pascal@2188 | 16 |
pascal@2188 | 17 case "$1" in |
pascal@2188 | 18 start) |
pascal@2188 | 19 # We need rsa and dsa host key file to start dropbear. |
pascal@2188 | 20 if [ ! -f /etc/ssh/ssh_host_rsa_key ] ; then |
pascal@2188 | 21 echo "Generating $NAME rsa key... " |
pascal@2188 | 22 ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -C '' -N '' |
pascal@2188 | 23 fi |
pascal@2188 | 24 if [ ! -f /etc/ssh/ssh_host_dsa_key ] ; then |
pascal@2188 | 25 echo "Generating $NAME dsa key... " |
pascal@2188 | 26 ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -C '' -N '' |
pascal@2188 | 27 fi |
pascal@2188 | 28 if [ -f $PIDFILE ] ; then |
pascal@2188 | 29 echo "$NAME already running." |
pascal@2188 | 30 exit 1 |
pascal@2188 | 31 fi |
pascal@2188 | 32 echo -n "Starting $DESC: $NAME... " |
pascal@2188 | 33 $DAEMON $OPTIONS |
pascal@2188 | 34 status |
pascal@2188 | 35 ;; |
pascal@2188 | 36 stop) |
pascal@2188 | 37 if [ ! -f $PIDFILE ] ; then |
pascal@2188 | 38 echo "$NAME is not running." |
pascal@2188 | 39 exit 1 |
pascal@2188 | 40 fi |
pascal@2188 | 41 echo -n "Stopping $DESC: $NAME... " |
pascal@2188 | 42 kill `cat $PIDFILE` |
pascal@2188 | 43 status |
pascal@2188 | 44 ;; |
pascal@2188 | 45 restart) |
pascal@2188 | 46 if [ ! -f $PIDFILE ] ; then |
pascal@2188 | 47 echo "$NAME is not running." |
pascal@2188 | 48 exit 1 |
pascal@2188 | 49 fi |
pascal@2188 | 50 echo -n "Restarting $DESC: $NAME... " |
pascal@2188 | 51 kill `cat $PIDFILE` |
pascal@2188 | 52 sleep 2 |
pascal@2188 | 53 $DAEMON $OPTIONS |
pascal@2188 | 54 status |
pascal@2188 | 55 ;; |
pascal@2188 | 56 *) |
pascal@2188 | 57 echo "" |
pascal@2188 | 58 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
pascal@2188 | 59 echo "" |
pascal@2188 | 60 exit 1 |
pascal@2188 | 61 ;; |
pascal@2188 | 62 esac |
pascal@2188 | 63 |
pascal@2188 | 64 exit 0 |