1 | 20 | simandl | #!/bin/bash |
2 | | | # chkconfig: 12345 55 45 |
3 | | | # description: System statistics |
4 | | | |
5 | | | cd "/opt/HotSaNIC" |
6 | | | |
7 | | | . ./settings |
8 | | | |
9 | | | case $1 in |
10 | | | start) |
11 | | | echo "Loading rrdtimer folder..." |
12 | | | posledni=`ls -c /opt_* | head -n 1 ` |
13 | | | cd "/" |
14 | | | tar xfz $posledni |
15 | | | cd "/opt/HotSaNIC" |
16 | | | |
17 | | | echo "Starting rrdtimer..." |
18 | | | ./rrdtimer.pl Dp |
19 | | | ;; |
20 | | | stop) |
21 | | | echo "Saving rrdtimer folder..." |
22 | | | /usr/local/bin/mrw |
23 | | | datum=`date '+%Y%m%d%H%M%S'` |
24 | | | archiv=/opt_$datum.tgz |
25 | | | tar cfz $archiv /opt/HotSaNIC |
26 | | | /usr/local/bin/mro |
27 | | | |
28 | | | echo "Stopping rrdtimer..." |
29 | | | if [ -e "$PIDFILE" ]; then |
30 | | | PID=`cat "$PIDFILE"` |
31 | | | for nn in $PID ; do kill $nn; done |
32 | | | else |
33 | | | echo "pid-file not found, rrdtimer not running?!" |
34 | | | fi |
35 | | | ./clearall CLEAR_COUNTERS |
36 | | | ;; |
37 | | | status) |
38 | | | if [ -e $PIDFILE ]; then |
39 | | | echo "main process on PID `cat $PIDFILE` (according to PID-file)" |
40 | | | else |
41 | | | echo "pid-file not found, rrdtimer not running?!" |
42 | | | fi |
43 | | | ;; |
44 | | | restart) |
45 | | | ./rrdgraph stop |
46 | | | ./rrdgraph start |
47 | | | ;; |
48 | | | *) |
49 | | | echo "usage: rrdgraph [start|stop|status|restart]" |
50 | | | ;; |
51 | | | esac |