File: tntnet.init

package info (click to toggle)
tntnet 2.2.1-4
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 5,164 kB
  • sloc: cpp: 16,433; sh: 11,720; ansic: 2,280; makefile: 779; perl: 159; xml: 124; sql: 10
file content (65 lines) | stat: -rw-r--r-- 1,762 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
#! /bin/sh
### BEGIN INIT INFO
# Provides:          tntnet.org
# Required-Start:    $local_fs $remote_fs $time $network
# Required-Stop:     $local_fs $remote_fs $time $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: modular, multithreaded web application server for C++
# Description:       web server in which dynamic content can be written in
#                    ecpp, where C++ code can be embedded in HTML layout.
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/tntnet
NAME=tntnet
DESC=tntnet

test -x $DAEMON || exit 0

. /lib/lsb/init-functions

# Include tntnet defaults if available
if [ -f /etc/default/tntnet ] ; then
	. /etc/default/tntnet
fi

set -e

do_start() {
	if [ "$NO_PORT_CHECK" != true ] && netstat -ln --tcp | grep -c ':80 ' > /dev/null ; then
		log_failure_msg "failed, socket in use."
	else
		start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS >/dev/null
		log_end_msg 0
	fi
}

case "$1" in
  start)
	log_daemon_msg "Starting web server" "$DESC"
	do_start
	;;
  stop)
	log_daemon_msg "Stopping web server" "$DESC"
	start-stop-daemon --stop --oknodo --pidfile /var/run/$NAME.pid --retry 20 --quiet --exec $DAEMON
	log_end_msg 0
	;;
  reload|force-reload)
	log_daemon_msg "Reloading configuration files" "$DESC"
	start-stop-daemon --stop --signal 1 --pidfile /var/run/$NAME.pid --quiet --exec $DAEMON
	log_end_msg 0
	;;
  restart)
	log_daemon_msg "Restarting web server" "$DESC"
	start-stop-daemon --stop --oknodo --pidfile /var/run/$NAME.pid --quiet --retry 20 --exec $DAEMON
	do_start
	;;
  *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
	exit 1
	;;
esac

exit 0