File: argus-server.init

package info (click to toggle)
argus 1%3A2.0.6.fixes.1-16.3
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 2,016 kB
  • ctags: 4,025
  • sloc: ansic: 23,022; sh: 5,734; makefile: 380; yacc: 255; lex: 234
file content (96 lines) | stat: -rw-r--r-- 2,054 bytes parent folder | download
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#! /bin/sh

# /etc/init.d/argus. Ripped from exim's init script.
# Modified by Yotam Rubin <yotam@makif.omer.k12.il>

### BEGIN INIT INFO
# Provides:          argus-server
# Required-Start:    $network $remote_fs
# Required-Stop:     $network $remote_fs
# Should-Start:      $local_fs
# Should-Stop:       $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Network auditing daemon
# Description:       Capture all traffic seen and record flow-based information
### END INIT INFO

set -e


DEFAULTS=/etc/default/argus-server
LOGFILE=/var/log/argus/argus.log
CONFFILE=/etc/argus.conf
DAEMON=/usr/sbin/argus
NAME=argus
PIDFILE=/var/run/argus.pid

# Check whether argus is disabled by /etc/default/argus-server.
# Argus is disabled by default, to enable argus please see 
# /etc/default/argus-server

test -f $DEFAULTS || exit 1

. $DEFAULTS

if [ "$STARTUP" = "dialup" ] || [ "$STARTUP" = "none" ]; then
    exit 1
fi

if [ ! -f $CONFFILE ]; then
    exit 1
fi

testrunning ()
{
    if [ -f $PIDFILE ] && [ -n "`ps ax | grep \`cat $PIDFILE\` | grep argus`" ]; 
    then
	echo "$DAEMON already running."
	exit 1
    fi
}

testpid ()
{
    if [ ! -f $PIDFILE ]; then
	echo "$DAEMON already stopped."
	exit 1
    fi
}
test -x $DAEMON || exit 1

case "$1" in
  start)
    echo -n "Starting network auditing daemon: "
    testrunning
    $DAEMON -w $LOGFILE -n $PIDFILE
    echo "argus. "
    ;;
  stop)
    echo -n "Stopping network auditing daemon: "
    testpid
    kill `cat $PIDFILE`
    rm -f "$PIDFILE"
    echo "argus."
      ;;
  restart)
    echo "Restarting network auditing daemon: "
    kill `cat $PIDFILE` > /dev/null 2>&1 || true
    rm -f "$PIDFILE"
    $DAEMON -w $LOGFILE -n $PIDFILE
    echo "argus. "
    ;;
  force-reload) 
    echo "Reloading argus configuration: "
    kill `cat $PIDFILE` > /dev/null 2>&1 || true
    rm -f "$PIDFILE"
    $DAEMON -w $LOGFILE -n $PIDFILE
    echo "argus. "
    ;;
  *)
    echo "Usage: /etc/init.d/$NAME {start|stop|force-reload|restart}"
    exit 1
    ;;
esac

exit 0