#!/bin/bash

# this scripts is called with the name of the interface in
# parameter $1

# source configuration file

export PATH=/sbin:/usr/sbin:/bin:/usr/bin

[ ! -f /etc/sysconfig/snort ] && echo "Can't run snort without a /etc/sysconfig/snort configuartion file!" && exit 1

# TODO: should make additional checks here

. /etc/sysconfig/snort

if [ "$SNORT_ACTIVATE" = "yes" -o "$SNORT_ACTIVATE" = "YES" ]; then
	# ok, we are on
	if [ "$SNORT_INTERFACE" = "$1" ]; then
		# it's our interface, let's do it
		/etc/init.d/snort stop > /dev/null
		/etc/init.d/snort start > /dev/null
	fi
fi

exit 0

