File: e2guardian.init

package info (click to toggle)
e2guardian 5.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 5,460 kB
  • sloc: cpp: 26,422; sh: 682; makefile: 525; perl: 141
file content (91 lines) | stat: -rw-r--r-- 2,665 bytes parent folder | download | duplicates (2)
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
83
84
85
86
87
88
89
90
91
#! /bin/sh
# Startup script for e2guardian
#
# description: A web content filtering plugin for web \
#              proxies, developed to filter using lists of \
#              banned phrases, MIME types, filename \
#              extensions and PICS labling.
# processname: e2guardian
# pidfile: /var/run/e2guardian.pid
# config: /etc/e2guardian/e2guardian.conf
### BEGIN INIT INFO
# Provides:          e2guardian
# Required-Start:    $remote_fs $network $syslog
# Required-Stop:     $remote_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Description: Starts e2guardian content proxy
# short-description: e2guardian configuration
### END INIT INFO

#include lsb functions
. /lib/lsb/init-functions

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/e2guardian
NAME=e2guardian
DESC="e2guardian"

CONFFILELOCATION=/etc/e2guardian/
#BINARYLOCATION=/usr/sbin/
#PIDDIR=/var/run/

grep -q ^UNCONFIGURED ${CONFFILELOCATION}e2guardian.conf && {
cat <<EOF
        e2guardian has not been configured!
        Please edit ${CONFFILELOCATION}e2guardian.conf manually then rerun
        this script.
EOF
exit; }

test -x $DAEMON || exit 0
test -f ${CONFFILELOCATION}e2guardian.conf || exit 0

set -e

case "$1" in
  start)
	log_daemon_msg "Starting $DESC" "$NAME"
	test -d /var/lock/subsys || mkdir -p /var/lock/subsys
	start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
		--exec $DAEMON || log_end_msg 1
	log_end_msg 0
	;;
  stop)
	log_daemon_msg "Stopping $DESC" "$NAME"
	start-stop-daemon --stop --quiet --retry 15 --oknodo --pidfile /var/run/$NAME.pid \
		--exec $DAEMON || log_end_msg 1
	log_end_msg 0
	;;
  reload)
	log_action_begin_msg "Reloading $DESC configuration..."
	echo "Reloading $DESC configuration files."
	start-stop-daemon --stop --signal 1 --quiet --pidfile \
		/var/run/$NAME.pid --exec $DAEMON || log_action_end_msg 1
	log_action_end_msg 0
  	;;
  restart|force-reload)
	#
	#	If the "reload" option is implemented, move the "force-reload"
	#	option to the "reload" entry above. If not, "force-reload" is
	#	just the same as "restart".
	#
	log_daemon_msg "Restarting $DESC" "$NAME"
	start-stop-daemon --stop --quiet --retry 15 --oknodo --pidfile \
		/var/run/$NAME.pid --exec $DAEMON || log_end_msg 1
	start-stop-daemon --start --quiet --pidfile \
		/var/run/$NAME.pid --exec $DAEMON || log_end_msg 1
	log_end_msg 0
	;;
  status)
	status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
	;;
  *)
	N=/etc/init.d/$NAME
	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
	log_action_msg "Usage: $N {start|stop|restart|force-reload|status}" >&2
	exit 1
	;;
esac

exit 0