]> git.pld-linux.org Git - packages/snort.git/blame - snort.init
- unicode.map added
[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 # nls "ERROR: Networking is down. %s can't be run." <service>
22 msg_network_down snort
23 exit 1
24 fi
4dee4001 25else
1396af1f 26 exit 0
4dee4001
AM
27fi
28
21789670 29RETVAL=0
4dee4001
AM
30# See how we were called.
31case "$1" in
32 start)
1396af1f 33 # Check if the service is already running?
34 if [ ! -f /var/lock/subsys/snort ]; then
35 # show "Starting %s service." <service>
36 msg_starting snort
197e01fd 37 # we need full path here; see SnortUsersManual.pdf
1396af1f 38 daemon /usr/sbin/snort \
c649dd1c 39 -u snort -g snort -d -D \
197e01fd 40 -l /var/log/snort -c /etc/snort/snort.conf
1396af1f 41 RETVAL=$?
42 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snort
43 else
44 # show "%s service is already running." <service>
45 msg_already_running snort
1396af1f 46 fi
4dee4001
AM
47 ;;
48 stop)
1396af1f 49 if [ -f /var/lock/subsys/snort ]; then
86cb99cc 50 # Stop daemons.
51 # show "Stopping %s service" <service>
1396af1f 52 msg_stopping snort
53 killproc snort
1396af1f 54 rm -f /var/lock/subsys/snort
21789670 55 else
56 msg_not_running snort
57 fi
86cb99cc 58 ;;
59 reload|force-reload)
60 if [ -f /var/lock/subsys/snort ]; then
61 msg_reloading snort
62 killproc snort -HUP
63 RETVAL=$?
1396af1f 64 else
65 # show "%s service is not running." <service>
21789670 66 msg_not_running snort >&2
67 exit 7
1396af1f 68 fi
4dee4001
AM
69 ;;
70 restart)
71 $0 stop
72 $0 start
21789670 73 exit $?
4dee4001
AM
74 ;;
75 status)
76 status snort
21789670 77 exit $?
4dee4001
AM
78 ;;
79 *)
86cb99cc 80 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
21789670 81 exit 3
4dee4001
AM
82esac
83
84exit $RETVAL
This page took 0.040833 seconds and 4 git commands to generate.