-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnfcapd
More file actions
78 lines (69 loc) · 1.47 KB
/
nfcapd
File metadata and controls
78 lines (69 loc) · 1.47 KB
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
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
#
#/etc/rc.d/init.d/nfcapd
#
### BEGIN INIT INFO
# Provides: nfcapd
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nfcapd daemon
# Description: nfcapd daemon
### END INIT INFO
#
#
#
#
start() {
echo -n "Starting : NetFlow Capture Daemon"
echo
if [ -f /var/run/nfcapd.pid ]; then
PID=$(cat /var/run/nfcapd.pid)
echo NetFlow Capture Daemon already running: $PID
exit 2;
else
/usr/local/bin/nfcapd -z -w -D -T all -l /tmp/ -I any -t 60 -P /var/run/nfcapd.pid
sleep 1
PID=$(cat /var/run/nfcapd.pid)
echo NetFlow Capture Daemon is started: $PID
return
fi
}
stop() {
echo -n "Shutting down : NetFlow Capture Daemon"
echo
kill $(cat /var/run/nfcapd.pid)
return
}
status(){
if [ -f /var/run/nfcapd.pid ]; then
PID=$(cat /var/run/nfcapd.pid)
echo NetFlow Capture Daemon is running: $PID
exit 2;
else
echo NetFlow Capture Daemon is stopped
return
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
stop
sleep 1
start
;;
*)
echo "Usage: {start|stop|status|restart]"
exit 1
;;
esac
exit $?