File: lsh-server.init.d

package info (click to toggle)
lsh-utils 2.1-12
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 12,884 kB
  • sloc: ansic: 51,017; sh: 5,683; lisp: 657; makefile: 381; perl: 63
file content (82 lines) | stat: -rw-r--r-- 2,224 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/sh
#
# lsh-utils	Start/stop secure shell server.
#		Written by Timshel Knoll <timshel@debian.org>
#		Updated by Stefan Pfetzing <dreamind@dreamind.de>
#               Updated by Magnus Holmgren <magnus@debian.org>

### BEGIN INIT INFO
# Provides:          lsh-server
# Required-Start:    $local_fs $remote_fs $syslog $named $network
# Required-Stop:     $local_fs $remote_fs $syslog $named $network
# X-Start-Before:    cman drbd smokeping vz
# X-Stop-After:      cman drbd smokeping vz
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: lsh secure shell server
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/lshd
NAME=lshd
DESC="secure shell v2 server"
CONFIG=/etc/default/lsh-server
PIDFILE=/var/run/$NAME.pid

RANDOM_SEED="/var/spool/lsh/yarrow-seed-file"
HOST_KEY="/etc/lsh_host_key"

test -f $DAEMON || exit 0

. /lib/lsb/init-functions

set +e

if [ -r "$CONFIG" ]; then
   . "$CONFIG"
fi

if [ x"$LSHD_PORT" = x ]; then
   LSHD_PORT="22"
fi

case "$ENABLE_SFTP" in
  true|y*|Y*)
    SFTP_FLAG="--subsystems sftp=/usr/lib/lsh-server/sftp-server"
    ;;
  *)
    SFTP_FLAG=""
    ;;
esac

case "$1" in
  start)
	log_daemon_msg "Starting $DESC" "$NAME"
	start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON \
                          -- --daemonic --port "$LSHD_PORT" $SFTP_FLAG $EXTRA_ARGS
	log_end_msg $?
	;;
  stop|graceful-stop)
	log_daemon_msg "Gracefully stopping $DESC" "$NAME"
	# Signal 1 causes the "old" lsh to close up shop on its port, but
	# keeps running until all active connections have been closed
	start-stop-daemon --stop --retry HUP/1 --quiet --pidfile $PIDFILE \
	    --oknodo --exec $DAEMON
	log_end_msg $?
	;;
  restart|force-reload)
	log_daemon_msg "Restarting $DESC" "$NAME"
	start-stop-daemon --stop --retry HUP/1 --quiet --pidfile $PIDFILE \
	    --oknodo --exec $DAEMON &&
	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
                       -- --daemonic --port "$LSHD_PORT" $SFTP_FLAG $EXTRA_ARGS
	log_end_msg $?
	;;
  status)
	status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
	;;
  *)
	echo "Usage: /etc/init.d/lsh-utils {start|stop|restart|force-reload}" >&2
	exit 3
	;;
esac