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