wok view openssh/stuff/openssh @ rev 11822
awesome: update bdeps
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Feb 26 20:49:05 2012 +0100 (2012-02-26) |
parents | 6e606489151e |
children | 469b918af40a |
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 active_pidfile $PIDFILE sshd ; then
29 echo "$NAME already running."
30 exit 1
31 fi
32 echo -n "Starting $DESC: $NAME... "
33 $DAEMON $OPTIONS
34 status
35 ;;
36 stop)
37 if ! active_pidfile $PIDFILE sshd ; then
38 echo "$NAME is not running."
39 exit 1
40 fi
41 echo -n "Stopping $DESC: $NAME... "
42 kill `cat $PIDFILE`
43 status
44 ;;
45 restart)
46 if ! active_pidfile $PIDFILE sshd ; then
47 echo "$NAME is not running."
48 exit 1
49 fi
50 echo -n "Restarting $DESC: $NAME... "
51 kill `cat $PIDFILE`
52 sleep 2
53 $DAEMON $OPTIONS
54 status
55 ;;
56 *)
57 echo ""
58 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
59 echo ""
60 exit 1
61 ;;
62 esac
64 exit 0