wok-6.x view openssh/stuff/openssh @ rev 14982

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