Add support for loongarch
[prads.git] / doc / prads.rc
blob58a283562bcf394ef053336a1497729f432a1263
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
14 #remember, for this to work out:
15 # groupadd -g 5505 prads
16 # useradd -g 5505 -u 5505 prads -h /var/run/prads -s /bin/false
17 # useradd -g 5505 -u 5505 prads -d /var/run/prads -s /bin/false
19 # Source function library
20 . /lib/lsb/init-functions
22 NAME=prads
23 DESC="Passive Realtime Asset Detection System"
24 PATH=/sbin:/bin:/usr/sbin:/usr/bin
26 USER=prads
27 GROUP=prads
28 DAEMON=/usr/bin/prads
29 LOGFILE=/var/log/prads-asset.log
30 RUNDIR=/var/run/prads
31 PIDFILE=$RUNDIR/$NAME.pid
32 HOME_NETS="10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fe80::/64"
33 PIDNAME=$(echo $PIDFILE|sed "s@^$RUNDIR@@")
35 test -x $DAEMON || exit 0
37 mkdir -p $RUNDIR
38 chgrp $GROUP $RUNDIR
39 chmod g+w $RUNDIR
41 # Include prads defaults if available
42 if [ -f /etc/default/prads ] ; then
43 . /etc/default/prads
45 DAEMON_OPTS=${DAEMON_OPTS:--D -u $(id -u $USER) -g $(id -g $GROUP) -C $RUNDIR -l $LOGFILE -a $HOME_NETS -p $PIDNAME}
47 if [ -n "$INTERFACE" ]
48 then
49 DAEMON_OPTS="$DAEMON_OPTS -i $INTERFACE"
53 case "$1" in
54 start)
55 output=$(/bin/tempfile -s.prads)
56 log_daemon_msg "Starting $DESC"
57 log_progress_msg $NAME
58 if start-stop-daemon \
59 --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- \
60 ${DAEMON_OPTS} > ${output} 2>&1; then
61 log_end_msg 0
62 else
63 log_end_msg 1
64 cat $output
65 exit 1
67 rm $output
69 stop)
70 log_daemon_msg "Stopping $DESC"
71 log_progress_msg $NAME
72 if start-stop-daemon \
73 --stop --quiet --pidfile $PIDFILE --retry 10 \
74 --exec $DAEMON; then
75 log_end_msg 0
76 else
77 log_end_msg 1
80 reload)
81 log_daemon_msg "Reloading $DESC"
82 log_progress_msg $NAME
83 if :; then
84 log_end_msg 0
85 else
86 log_end_msg 1
89 status)
90 status_of_proc -p "${PIDFILE}" "${DAEMON}" "${NAME}"
92 restart|force-reload)
93 $0 stop
94 $0 start
97 log_success_msg "Usage: $0 {start|stop|restart|force-reload}"
98 exit 1
100 esac
102 exit 0