wok view openssh/stuff/openssh @ rev 17257

Up: yad (0.27.0).
author Aleksej Bobylev <al.bobylev@gmail.com>
date Tue Oct 21 16:31:29 2014 +0300 (2014-10-21)
parents 469b918af40a
children e2e3be9972fa
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 [ -d /var/run/sshd ] || mkdir -p /var/run/sshd
18 case "$1" in
19 start)
20 # We need rsa and dsa host key file to start dropbear.
21 if [ ! -f /etc/ssh/ssh_host_rsa_key ] ; then
22 echo "Generating $NAME rsa key... "
23 ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -C '' -N ''
24 fi
25 if [ ! -f /etc/ssh/ssh_host_dsa_key ] ; then
26 echo "Generating $NAME dsa key... "
27 ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -C '' -N ''
28 fi
29 if [ ! -f /etc/ssh/ssh_host_ecdsa_key ] ; then
30 echo "Generating $NAME ecdsa key... "
31 ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -C '' -N ''
32 fi
33 if active_pidfile $PIDFILE sshd ; then
34 echo "$NAME already running."
35 exit 1
36 fi
37 echo -n "Starting $DESC: $NAME... "
38 $DAEMON $OPTIONS
39 status
40 ;;
41 stop)
42 if ! active_pidfile $PIDFILE sshd ; then
43 echo "$NAME is not running."
44 exit 1
45 fi
46 echo -n "Stopping $DESC: $NAME... "
47 kill `cat $PIDFILE`
48 status
49 ;;
50 restart)
51 if ! active_pidfile $PIDFILE sshd ; then
52 echo "$NAME is not running."
53 exit 1
54 fi
55 echo -n "Restarting $DESC: $NAME... "
56 kill `cat $PIDFILE`
57 sleep 2
58 $DAEMON $OPTIONS
59 status
60 ;;
61 *)
62 echo ""
63 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
64 echo ""
65 exit 1
66 ;;
67 esac
69 exit 0