-
Notifications
You must be signed in to change notification settings - Fork 4
/
init.d.suricata
67 lines (60 loc) · 1.29 KB
/
init.d.suricata
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# barnyard2 init file for linux
#
# chkconfig: - 99 99
# description: barnyard2 Daemon
#
# processname: /usr/local/bin/suricata
# config: /usr/local/etc/suricata/suricata.yaml
# pidfile: /var/run/suricata.pid
# source function library
. /etc/init.d/functions
#export LD_PRELOAD=/usr/lib64/libtcmalloc_minimal.so.4
CONFDIR=/usr/local/etc/suricata
RETVAL=0
prog="suricata"
OPTIONS="--pfring-int=eth1 --pfring-cluster-id=99 --pfring-cluster-type=cluster_flow -c ${CONFDIR}/suricata.yaml -D >> /tmp/suricata.log"
PROCESSNAME=/usr/local/bin/suricata
start() {
echo -n $"Starting $prog: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
daemon $PROCESSNAME $OPTIONS
RETVAL=$?
fi;
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
killproc $PROCESSNAME
RETVAL=$?
fi;
echo
return $RETVAL
}
restart(){
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
RETVAL=1
esac
exit $RETVAL