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 | 24 | simandl | ./rrdgraph save |
25 | 20 | simandl | |
26 | | | echo "Stopping rrdtimer..." |
27 | | | if [ -e "$PIDFILE" ]; then |
28 | | | PID=`cat "$PIDFILE"` |
29 | | | for nn in $PID ; do kill $nn; done |
30 | | | else |
31 | | | echo "pid-file not found, rrdtimer not running?!" |
32 | | | fi |
33 | | | ./clearall CLEAR_COUNTERS |
34 | | | ;; |
35 | 24 | simandl | save) |
36 | | | echo "Saving rrdtimer folder..." |
37 | | | /bin/mount / -o remount,rw,noatime |
38 | | | datum=`date '+%Y%m%d%H%M%S'` |
39 | | | archiv=/opt_$datum.tgz |
40 | | | tar cfz $archiv /opt/HotSaNIC |
41 | | | /bin/mount / -o remount,ro,noatime |
42 | | | ;; |
43 | 20 | simandl | status) |
44 | | | if [ -e $PIDFILE ]; then |
45 | | | echo "main process on PID `cat $PIDFILE` (according to PID-file)" |
46 | | | else |
47 | | | echo "pid-file not found, rrdtimer not running?!" |
48 | | | fi |
49 | | | ;; |
50 | | | restart) |
51 | | | ./rrdgraph stop |
52 | | | ./rrdgraph start |
53 | | | ;; |
54 | | | *) |
55 | 24 | simandl | echo "usage: rrdgraph [start|stop|status|restart|save]" |
56 | 20 | simandl | ;; |
57 | | | esac |