summaryrefslogtreecommitdiff
path: root/network/snort/rc.snort
diff options
context:
space:
mode:
Diffstat (limited to 'network/snort/rc.snort')
-rw-r--r--network/snort/rc.snort22
1 files changed, 13 insertions, 9 deletions
diff --git a/network/snort/rc.snort b/network/snort/rc.snort
index 9aaf410fcf..228e8da4e3 100644
--- a/network/snort/rc.snort
+++ b/network/snort/rc.snort
@@ -1,7 +1,7 @@
#!/bin/sh
# Start/stop/restart snort
-# This tell snort which interface to listen on (any for every interface)
+# This tell snort which interface to listen on ("any" == every interface)
IFACE=${IFACE:-any}
# Make sure this matches your IFACE
@@ -23,18 +23,22 @@ snort_start() {
# Stop snort:
snort_stop() {
- echo -n "Stopping Snort daemon ($IFACE)..."
- kill $(cat $PIDFILE)
- echo
- sleep 1
- rm -f $PIDFILE
+ if [ -f "$PIDFILE" ]; then
+ echo -n "Stopping Snort daemon (interface $IFACE)..."
+ kill $(cat $PIDFILE)
+ echo
+ sleep 1
+ rm -f $PIDFILE
+ else
+ echo "Pidfile $PIDFILE not found!"
+ echo "Either Snort is not running or you should specify IFACE=xxxx"
+ exit 1
+ fi
}
# Restart snort:
snort_restart() {
- snort_stop
- sleep 1
- snort_start
+ snort_stop && sleep 1 && snort_start
}
case "$1" in