Debian Codegraph @

support/Startup/rasplit

raw
1 #!/bin/sh
2 # Argus Software
3 # Copyright (c) 2000-2024 QoSient, LLC
4 # All rights reserved.
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #
20 #
21 # rasplit This shell script takes care of starting and stopping rasplit.
22 #
23 # chkconfig: 2345 55 45
24 # description: rasplit-3.0 collects and writes argus data into an archive.
25 # processname: rasplit
26 # config: none
27
28 #
29 # The assumption here is that rasplit is not using any special configurations
30 # i.e. that /etc/rarc.conf does not exist.
31 #
32
33 # Source function library.
34 if [ -f /etc/init.d/functions ]; then
35 . /etc/init.d/functions
36 else
37 if [ -f /etc/rc.d/init.d/functions ]; then
38 . /etc/init.d/functions
39 fi
40 fi
41
42 # Source networking configuration.
43 . /etc/sysconfig/network
44
45 # Check that networking is up.
46 [ ${NETWORKING} = "no" ] && exit 1
47
48
49 # Set rasplit path by defining $RASPLITHOME for this script.
50 # If rasplit was installed in another way, modify PATH to
51 # include the directory where the rasplit binary was installed.
52
53 RASPLITDIR=/usr/local/bin
54 ARGUSARCHIVE=/usr/local/argus/archive
55
56 export PATH=$RASPLITDIR:$PATH
57
58 [ -f $RASPLITDIR/rasplit ] || exit 1
59
60 RETVAL=0
61 RASPLIT=$RASPLITDIR/rasplit
62 RASPLITOPTIONS="-d -M time 5m -w $ARGUSARCHIVE/\$srcid/%Y/%m/%d/argus.%Y.%m.%d.%H.%M.%S > /dev/null 2>&1"
63
64 start() {
65 # Start daemons.
66 echo -n "Starting rasplit: "
67 if [ ! -d $ARGUSARCHIVE ] then
68 mkdir $ARGUSARCHIVE
69 fi
70 initlog -c "$RASPLIT $RASPLITOPTIONS" && success || failure
71 RETVAL=$?
72 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rasplit
73 echo
74 }
75
76 stop() {
77 # Stop daemons.
78 echo -n "Stopping rasplit: "
79 killproc rasplit
80 RETVAL=$?
81 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/rasplit
82 echo
83 }
84
85 # See how we were called.
86 case "$1" in
87 start)
88 start
89 RETVAL=$?
90 ;;
91 stop)
92 stop
93 RETVAL=$?
94 ;;
95 restart|reload)
96 stop
97 start
98 RETVAL=$?
99 ;;
100 condrestart)
101 if [ -f /var/lock/subsys/rasplit ]; then
102 stop
103 start
104 RETVAL=$?
105 fi
106 ;;
107 status)
108 status rasplit
109 RETVAL=$?
110 ;;
111 *)
112 echo "Usage: rasplit {start|stop|restart|condrestart|status}"
113 exit 1
114 ;;
115 esac
116 exit $RETVAL