3
# Written by Hugo Haas <hugo@debian.org>.
4
# Modified by Marc Haber <mh+debian-packages@zugschlus.de>.
8
# Required-Start: $local_fs $remote_fs $syslog $named $network $time
9
# Required-Stop: $local_fs $remote_fs $syslog $named $network
12
# Default-Start: 2 3 4 5
14
# Short-Description: IP protocols logger
15
# Description: ippl writes information about incoming network traffic
20
if [ -r "/lib/lsb/init-functions" ]; then
21
. /lib/lsb/init-functions
23
echo "E: /lib/lsb/init-functions not found, lsb-base (>= 3.0-6) needed"
27
PATH="/bin:/usr/bin:/sbin:/usr/sbin"
29
RUNDIR="/var/run/ippl"
30
PIDFILE="$RUNDIR/ippl.pid"
32
CONFDDIR="$CONFDIR/ippl.conf.d"
33
CONFFILE="$RUNDIR/ippl.conf"
36
DAEMON="/usr/sbin/ippl"
38
DESC="IP protocols logger"
40
test -f $DAEMON || exit 0
42
# this is from madduck on IRC, 2006-07-06
43
# There should be a better possibility to give daemon error messages
44
# and/or to log things
48
[[:digit:]]*) success=$1; shift;;
51
log_action_begin_msg "$1"; shift
52
log_action_end_msg ${success:-0} "$*"
56
# run-parts emulation, stolen from Branden's /etc/X11/Xsession
57
# Addition: Use file.rul instead if file if it exists.
60
unset LANG LC_COLLATE LC_ALL
63
log "internal run_parts called without an argument"
65
if [ ! -d "$1" ]; then
66
log "internal run_parts called, but $1 does not exist or is not a directory."
69
if expr "$F" : '[[:alnum:]_-]\+$' > /dev/null 2>&1; then
70
if [ -f "$1/$F" ] ; then
71
if [ -f "$1/${F}.rul" ] ; then
83
log "internal cat_parts called without an argument"
85
if [ ! -d "$1" ]; then
88
for file in $(run_parts $1); do
89
echo "#####################################################"
91
echo "#####################################################"
94
echo "#####################################################"
96
echo "#####################################################"
101
if [ "x${IPPLCOMMENTS}" = "xno" ] ; then
102
grep -E -v '^[[:space:]]*#' | sed -e '/^$/N;/\n$/D' ;
110
cat << EOF > ${CONFFILE}.tmp
112
# WARNING WARNING WARNING
113
# WARNING WARNING WARNING
114
# WARNING WARNING WARNING
115
# WARNING WARNING WARNING
116
# WARNING WARNING WARNING
117
# this file is generated dynamically from /etc/ippl/ippl.conf and the files
118
# in /etc/ippl/ippl.conf.d
119
# Any changes you make here will be lost.
120
# WARNING WARNING WARNING
121
# WARNING WARNING WARNING
122
# WARNING WARNING WARNING
123
# WARNING WARNING WARNING
124
# WARNING WARNING WARNING
128
(cat ${CONFDIR}/ippl.conf 2>/dev/null; cat_parts ${CONFDDIR}) | \
132
# test validity if called without -o
133
# this is not currently possible with ippl,
134
# but can be easily enabled with this (of course untested) example code
135
#if [ "x${CONFFILE}" = "x${AUTOCONFIGFILE}" ] && \
136
# [ -x ${DAEMON} ] ; then
137
# if ! ${DAEMON} --config "${CONFFILE}.tmp" > /dev/null ; then
138
# log "Invalid new configfile ${CONFFILE}.tmp"
139
# log "not installing ${CONFFILE}.tmp to ${CONFFILE}"
144
mv -f ${CONFFILE}.tmp ${CONFFILE}
148
pidofproc -p $PIDFILE $DAEMON > /dev/null
152
if ! check_started; then
153
start_daemon -p $PIDFILE $DAEMON -c /var/run/ippl/ippl.conf
156
log_failure_msg "already running!"
164
killproc -p $PIDFILE $DAEMON
170
log_action_begin_msg "checking $DAEMON"
171
if check_started; then
172
log_action_end_msg 0 "running"
174
if [ -e "$PIDFILE" ]; then
175
log_action_end_msg 1 "$DAEMON failed"
178
log_action_end_msg 0 "not running"
185
[ -e /var/run/ippl ] || \
186
install -d -oDebian-ippl -gDebian-ippl -m755 /var/run/ippl
190
log_daemon_msg "Starting $DESC" "$NAME"
196
log_daemon_msg "Stopping $DESC" "$NAME"
200
restart|force-reload)
201
log_daemon_msg "Restarting $DESC" "$NAME"
203
if [ -z "$?" -o "$?" = "0" ]; then
213
log_failure_msg "Usage: $0 {start|stop|restart|force-reload|status}" >&2