[Snort-users] Start snort in daemon mode

Tim Slighter tslighter at ...5174...
Tue Nov 23 08:48:00 EST 2004


try this script out:

#! /bin/bash
#
# snortd          Start/Stop the snort daemon.
#
# processname: snortd
# pidfile: /var/run/snortd.pid

# Source function library.
. /etc/init.d/functions

RETVAL=0

# See how we were called.

prog="Snort"

start() {
        echo -n $"Starting $prog: "
        daemon /usr/local/bin/snort -D -d -N -c 
/usr/local/snort/etc/snort.conf -i eth0 -g nobody -u nobody
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snortd
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: "
        killproc snortd
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/snortd
        return $RETVAL
}

rhstatus() {
status snortd
}

restart() {
        stop
        start
}

reload() {
        echo -n $"Reloading snortd daemon configuration: "
        killproc snortd -HUP
        retval=$?
        echo
        return $RETVAL
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  reload)
        reload
        ;;
  status)
        rhstatus
        ;;
  condrestart)
        [ -f /var/lock/subsys/snortd ] && restart || :
        ;;
  *)
echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
        exit 1
esac

exit $?


McKeeman, Samuel wrote:

> Hello,
>
>             I was wondering if anyone could tell me how to start snort 
> to run in daemon mode automatically?
>
> Thanks
>
> -sam
>
> |
>
> This email may contain confidential or privileged information. If you 
> believe you have received the message in error, please notify the 
> sender and delete the message without copying or disclosing it.
> | 





More information about the Snort-users mailing list