#! /bin/sh # # Author: Impriser # # /sbin/init.d/ # # and symbolic its link # # /sbin/rc # # The echo return value for success (defined in /etc/rc.config). case "$1" in start) echo -n "Starting snortd" ## Start daemon with startproc(8). If this fails ## the echo return value is set appropriate. startproc /usr/local/bin/snort -d -D -c /etc/snort/snort.conf || return=$rc_failed echo -e "$return" ;; stop) echo -n "Shutting down service foo" ## Stop daemon with killproc(8) and if this fails ## set echo the echo return value. killproc -TERM /usr/local/bin/snort || return=$rc_failed echo -e "$return" ;; restart) ## If first returns OK call the second, if first or ## second command fails, set echo return value. $0 stop && $0 start || return=$rc_failed ;; status) echo -n "Checking for service foo: " ## Check status with checkproc(8), if process is running ## checkproc will return with exit status 0. checkproc /usr/local/bin/snort && echo OK || echo No process ;; *) echo "Usage: $0 {start|stop|status|restart|reload}" exit 1 ;; esac # Inform the caller not only verbosely and set an exit status. test "$return" = "$rc_done" || exit 1 exit 0