chrooted rc file
[prads.git] / doc / prads.rc
blob35d222e18d1c87bd9158dc0ca50041e7312a794b
1 #! /bin/sh
3 ### BEGIN INIT INFO
4 # Provides: prads
5 # Required-Start: $local_fs $remote_fs $network
6 # Required-Stop: $local_fs $remote_fs $network
7 # Default-Start: 2 3 4 5
8 # Default-Stop: 0 1 6
9 # Short-Description: Start PRADS sensor.
10 # Description: This script provides a packet level
11 # passive host and service detecion system
12 # in a chroot environment
13 ### END INIT INFO
15 # Source function library
16 . /lib/lsb/init-functions
18 NAME=prads
19 DESC="Passive Realtime Asset Detection System"
20 PATH=/sbin:/bin:/usr/sbin:/usr/bin
22 DAEMON=/usr/bin/prads
23 RUNDIR=/var/run/prads
24 PIDFILE=$RUNDIR/$NAME.pid
25 LOGFILE=/var/log/prads.log
26 DAEMON_OPTS="-u 6005 -g 6005 -D -C $RUNDIR -l $LOGFILE -p $NAME.pid"
28 mkdir $RUNDIR
29 test -x $DAEMON || exit 0
31 # Include prads defaults if available
32 if [ -f /etc/default/prads ] ; then
33 . /etc/default/prads
36 case "$1" in
37 start)
38 output=$(/bin/tempfile -s.prads)
39 log_daemon_msg "Starting $DESC"
40 log_progress_msg $NAME
41 if start-stop-daemon \
42 --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- \
43 -P ${PIDFILE} ${DAEMON_OPTS} > ${output} 2>&1; then
44 log_end_msg 0
45 else
46 log_end_msg 1
47 cat $output
48 exit 1
50 rm $output
52 stop)
53 log_daemon_msg "Stopping $DESC"
54 log_progress_msg $NAME
55 if start-stop-daemon \
56 --stop --quiet --pidfile $PIDFILE --retry 10 \
57 --exec $DAEMON; then
58 log_end_msg 0
59 else
60 log_end_msg 1
63 reload)
64 log_daemon_msg "Reloading $DESC"
65 log_progress_msg $NAME
66 if :; then
67 log_end_msg 0
68 else
69 log_end_msg 1
72 status)
73 status_of_proc -p "${PIDFILE}" "${DAEMON}" "${NAME}"
75 restart|force-reload)
76 $0 stop
77 $0 start
80 log_success_msg "Usage: $0 {start|stop|restart|force-reload}"
81 exit 1
83 esac
85 exit 0