summaryrefslogtreecommitdiffstats
path: root/abs/extra-testing/rrd_stats/rrd_stats.install
blob: e63b0eb09c1a1b3788579e28f81b054318227528 (plain)
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
post_install() {
	PFIX="/data/srv/httpd/htdocs/rrd"
	if [ ! -e $PFIX/index.html.orig ]
	then
		mv $PFIX/index.html  $PFIX/index.html.orig
		ln -s $PFIX/index-rrd.html $PFIX/index.html
	fi

	ct=`crontab -l`
	echo $ct | grep -q rrd_hddtemp.pl
	if [ $? != 0 ]
	then
		line="*/5 * * * *       /usr/bin/rrd_hddtemp.pl > /dev/null"
		(crontab -l; echo "$line") | crontab -
	fi

	echo $ct | grep -q rrd_disk.pl
	if [ $? != 0 ]
	then
		line="*/5 * * * *       /usr/bin/rrd_disk.pl > /dev/null"
		(crontab -l; echo "$line") | crontab -
	fi	

	echo $ct | grep -q rrd_traffic.pl
	if [ $? != 0 ]
	then
		line="*/5 * * * *       /usr/bin/rrd_traffic.pl > /dev/null"
		(crontab -l; echo "$line") | crontab -
	fi
	
	echo $ct | grep -q rrd_mem.pl
	if [ $? != 0 ]
	then
		line="*/5 * * * *       /usr/bin/rrd_mem.pl > /dev/null"
		(crontab -l; echo "$line") | crontab -
	fi
	
	echo $ct | grep -q rrd_cpu.pl
	if [ $? != 0 ]
	then
		line="*/5 * * * *       /usr/bin/rrd_cpu.pl > /dev/null"
		(crontab -l; echo "$line") | crontab -
	fi

	echo $ct | grep -q rrd_usage.pl
	if [ $? != 0 ]
	then
		line="*/5 * * * *       /usr/bin/rrd_usage.pl > /dev/null"
		(crontab -l; echo "$line") | crontab -
	fi


}

post_upgrade() {
 	post_install $1
}


pre_remove() {
	crontab -l | grep -v rrd_ | crontab - 
	PFIX="/data/srv/httpd/htdocs/rrd"
	if [  -e $PFIX/index.html.orig ]
	then
		rm $PFIX/index.html
		mv $PFIX/index.html.orig  $PFIX/index.html
	fi

}