summarylogtreecommitdiffstats
path: root/nagios.install
blob: 36f038c0dd1fe49a03cbf406c1124f62718c95d6 (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
# arg 1:  the new package version

post_install() {
	cat <<EOM

--> Sample config files are installed with .sample extension.
--> Remember, these are *SAMPLE* config files.  You'll need to read
--> the documentation for more information on how to actually define
--> services, hosts, etc. to fit your particular needs.

EOM

	getent group nagios > /dev/null || groupadd -g 30 nagios > /dev/null
	getent passwd nagios > /dev/null || useradd -u 30 -g nagios -d /dev/null -s /bin/false nagios > /dev/null
}

pre_upgrade() {

	_httpdconf="/etc/httpd/conf/extra/nagios.conf"
	if [ -f $_httpdconf ]; then
		cp $_httpdconf $_httpdconf.pacsave
	fi
	
}

post_upgrade() {

	post_install

	find /var/nagios -user nobody -exec chown nagios.nagios {} \;
	if [ -f /var/log/nagios.log ]; then
	   chown nagios /var/log/nagios.log
	fi

	_httpdconf="/etc/httpd/conf/extra/nagios.conf"
	if [ ! -f $_httpdconf -a -f $_httpdconf.pacsave ]; then
		cp $_httpdconf.pacsave $_httpdconf
	fi

}