]> git.pld-linux.org Git - packages/snort.git/blame - snort.init
- fix linking
[packages/snort.git] / snort.init
CommitLineData
4dee4001
AM
1#!/bin/sh
2#
1396af1f 3# snort Start/Stop the snort IDS daemon.
4dee4001 4#
1396af1f 5# chkconfig: 2345 85 24
0eb27715 6# description: snort is a lightweight network intrusion detection tool that \
7# currently detects more than 1100 host and network \
4dee4001
AM
8# vulnerabilities, portscans, backdoors, and more.
9#
10
11# Source function library.
12. /etc/rc.d/init.d/functions
06da3568 13. /etc/sysconfig/network
4dee4001
AM
14
15# Get service config - may override defaults
16[ -f /etc/sysconfig/snort ] && . /etc/sysconfig/snort
17
18# Check that networking is up.
19if is_yes "${NETWORKING}"; then
f3f7371d 20 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
1396af1f 21 msg_network_down snort
22 exit 1
23 fi
4dee4001 24else
1396af1f 25 exit 0
4dee4001
AM
26fi
27
21789670 28RETVAL=0
4dee4001
AM
29# See how we were called.
30case "$1" in
31 start)
1396af1f 32 # Check if the service is already running?
33 if [ ! -f /var/lock/subsys/snort ]; then
1396af1f 34 msg_starting snort
197e01fd 35 # we need full path here; see SnortUsersManual.pdf
1396af1f 36 daemon /usr/sbin/snort \
c649dd1c 37 -u snort -g snort -d -D \
197e01fd 38 -l /var/log/snort -c /etc/snort/snort.conf
1396af1f 39 RETVAL=$?
40 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snort
41 else
1396af1f 42 msg_already_running snort
1396af1f 43 fi
4dee4001
AM
44 ;;
45 stop)
1396af1f 46 if [ -f /var/lock/subsys/snort ]; then
86cb99cc 47 # Stop daemons.
1396af1f 48 msg_stopping snort
49 killproc snort
1396af1f 50 rm -f /var/lock/subsys/snort
21789670 51 else
52 msg_not_running snort
53 fi
86cb99cc 54 ;;
55 reload|force-reload)
56 if [ -f /var/lock/subsys/snort ]; then
57 msg_reloading snort
58 killproc snort -HUP
59 RETVAL=$?
1396af1f 60 else
21789670 61 msg_not_running snort >&2
62 exit 7
1396af1f 63 fi
4dee4001
AM
64 ;;
65 restart)
66 $0 stop
67 $0 start
21789670 68 exit $?
4dee4001
AM
69 ;;
70 status)
71 status snort
21789670 72 exit $?
4dee4001
AM
73 ;;
74 *)
86cb99cc 75 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
21789670 76 exit 3
4dee4001
AM
77esac
78
79exit $RETVAL
This page took 0.250586 seconds and 4 git commands to generate.