ubuntu-buildroot/package/suricata/S99suricata

65 lines
1.0 KiB
Plaintext
Raw Permalink Normal View History

2024-04-01 15:19:46 +00:00
#!/bin/sh
DAEMON=suricata
PIDFILE=/var/run/$DAEMON.pid
SURICATA_ARGS="-c /etc/suricata/suricata.yaml -i eth0"
SURICATA_RELOAD=0
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
start() {
printf 'Starting %s: ' "$DAEMON"
mkdir -p /var/log/suricata
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \
-- $SURICATA_ARGS
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
stop() {
printf 'Stopping %s: ' "$DAEMON"
start-stop-daemon -K -q -p "$PIDFILE"
status=$?
if [ "$status" -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
restart() {
stop
sleep 1
start
}
# SIGUSR2 makes suricata reload rules
reload() {
printf 'Reloading %s: ' "$DAEMON"
start-stop-daemon -K -s "$SURICATA_RELOAD" -q -p "$PIDFILE"
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
case "$1" in
start|stop|restart|reload)
"$1";;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac