Rev 61 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2 | magnus | 1 | #!/bin/sh |
| 2 | # |
||
| 3 | # lsh-utils Start/stop secure shell server. |
||
| 4 | # Written by Timshel Knoll <timshel@debian.org> |
||
| 5 | # Updated by Stefan Pfetzing <dreamind@dreamind.de> |
||
| 39 | magnus | 6 | # Updated by Magnus Holmgren <magnus@debian.org> |
| 2 | magnus | 7 | |
| 8 | ### BEGIN INIT INFO |
||
| 39 | magnus | 9 | # Provides: lsh-server |
| 2 | magnus | 10 | # Required-Start: $local_fs $remote_fs $syslog $named $network |
| 11 | # Required-Stop: $local_fs $remote_fs $syslog $named $network |
||
| 39 | magnus | 12 | # X-Start-Before: cman drbd smokeping vz |
| 13 | # X-Stop-After: cman drbd smokeping vz |
||
| 2 | magnus | 14 | # Default-Start: 2 3 4 5 |
| 15 | # Default-Stop: 0 1 6 |
||
| 16 | # Short-Description: lsh secure shell server |
||
| 17 | ### END INIT INFO |
||
| 18 | |||
| 19 | PATH=/sbin:/bin:/usr/sbin:/usr/bin |
||
| 20 | DAEMON=/usr/sbin/lshd |
||
| 21 | NAME=lshd |
||
| 22 | DESC="secure shell v2 server" |
||
| 23 | CONFIG=/etc/default/lsh-server |
||
| 39 | magnus | 24 | PIDFILE=/var/run/$NAME.pid |
| 2 | magnus | 25 | |
| 26 | RANDOM_SEED="/var/spool/lsh/yarrow-seed-file" |
||
| 27 | HOST_KEY="/etc/lsh_host_key" |
||
| 28 | |||
| 29 | test -f $DAEMON || exit 0 |
||
| 30 | |||
| 39 | magnus | 31 | . /lib/lsb/init-functions |
| 2 | magnus | 32 | |
| 39 | magnus | 33 | set +e |
| 34 | |||
| 2 | magnus | 35 | if [ -r "$CONFIG" ]; then |
| 36 | . "$CONFIG" |
||
| 37 | fi |
||
| 38 | |||
| 39 | if [ x"$LSHD_PORT" = x ]; then |
||
| 40 | LSHD_PORT="22" |
||
| 41 | fi |
||
| 42 | |||
| 43 | case "$ENABLE_SFTP" in |
||
| 44 | true|y*|Y*) |
||
| 8 | magnus | 45 | SFTP_FLAG="--subsystems sftp=/usr/lib/lsh-server/sftp-server" |
| 2 | magnus | 46 | ;; |
| 47 | *) |
||
| 48 | SFTP_FLAG="" |
||
| 49 | ;; |
||
| 50 | esac |
||
| 51 | |||
| 52 | case "$1" in |
||
| 53 | start) |
||
| 59 | magnus | 54 | log_daemon_msg "Starting $DESC" "$NAME" |
| 39 | magnus | 55 | start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON \ |
| 99 | magnus | 56 | -- --daemonic --port "$LSHD_PORT" $SFTP_FLAG $EXTRA_ARGS |
| 59 | magnus | 57 | log_end_msg $? |
| 2 | magnus | 58 | ;; |
| 59 | stop|graceful-stop) |
||
| 59 | magnus | 60 | log_daemon_msg "Gracefully stopping $DESC" "$NAME" |
| 2 | magnus | 61 | # Signal 1 causes the "old" lsh to close up shop on its port, but |
| 62 | # keeps running until all active connections have been closed |
||
| 39 | magnus | 63 | start-stop-daemon --stop --retry HUP/1 --quiet --pidfile $PIDFILE \ |
| 64 | --oknodo --exec $DAEMON |
||
| 59 | magnus | 65 | log_end_msg $? |
| 2 | magnus | 66 | ;; |
| 67 | restart|force-reload) |
||
| 59 | magnus | 68 | log_daemon_msg "Restarting $DESC" "$NAME" |
| 39 | magnus | 69 | start-stop-daemon --stop --retry HUP/1 --quiet --pidfile $PIDFILE \ |
| 70 | --oknodo --exec $DAEMON && |
||
| 71 | start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ |
||
| 99 | magnus | 72 | -- --daemonic --port "$LSHD_PORT" $SFTP_FLAG $EXTRA_ARGS |
| 59 | magnus | 73 | log_end_msg $? |
| 2 | magnus | 74 | ;; |
| 39 | magnus | 75 | status) |
| 76 | status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? |
||
| 77 | ;; |
||
| 2 | magnus | 78 | *) |
| 79 | echo "Usage: /etc/init.d/lsh-utils {start|stop|restart|force-reload}" >&2 |
||
| 39 | magnus | 80 | exit 3 |
| 2 | magnus | 81 | ;; |
| 82 | esac |