Added Mac OS X launchd script
authorAlexander Barton <alex@barton.de>
Mon, 14 Dec 2009 00:52:25 +0000 (01:52 +0100)
committerAlexander Barton <alex@barton.de>
Mon, 14 Dec 2009 00:52:25 +0000 (01:52 +0100)
The launchd script for Mac OS X is installed to /Library/LaunchDaemons
and loaded during "make install-client".

Makefile
client/lib/de.barton.nagcollect [new file with mode: 0644]
contrib/Makefile.Darwin [new file with mode: 0644]

index 3ef6ac5..6835bdb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,8 @@ install-server:
                server/bin/nagios-submit-service /usr/local/sbin/nagios-submit-service
        install -D -o root -g root -m 644 -p \
                server/web/nagcollect.php /var/www/nagcollect.php
+       [ -r contrib/Makefile.`uname` ] \
+               && make -f contrib/Makefile.`uname` "install-server" || true
 
 install-client:
        install -d -o 0 -g 0 -m 755 /usr/local/sbin
@@ -41,6 +43,8 @@ install-client:
          install -o 0 -g 0 -m 644 "$$x" "/usr/local/lib/nagcollect/$$x"; \
         done \
        )
+       [ -r contrib/Makefile.`uname` ] \
+               && make -f contrib/Makefile.`uname` "install-client" || true
 
 nagcollecttestscripts:
        tar -czvf nagcollecttestscripts.tgz -C client/lib/tests .
diff --git a/client/lib/de.barton.nagcollect b/client/lib/de.barton.nagcollect
new file mode 100644 (file)
index 0000000..2ce97e5
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>Label</key>
+       <string>de.barton.nagcollect</string>
+       <key>Program</key>
+       <string>/usr/local/sbin/nagcollect</string>
+       <key>Nice</key>
+       <integer>5</integer>
+       <key>RunAtLoad</key>
+       <true/>
+       <key>StartInterval</key>
+       <integer>900</integer>
+</dict>
+</plist>
diff --git a/contrib/Makefile.Darwin b/contrib/Makefile.Darwin
new file mode 100644 (file)
index 0000000..cc516d5
--- /dev/null
@@ -0,0 +1,17 @@
+#
+# NagCollect -- Nagios Data Collector for Passive Checks
+# Copyright (c)2009 Alexander Barton, alex@barton.de
+#
+
+install-client:
+       [ -r /Library/LaunchDaemons/de.barton.nagcollect ] \
+               && launchctl unload -w /Library/LaunchDaemons/de.barton.nagcollect \
+               || true
+       install -d -o 0 -g 0 -m 755 /Library/LaunchDaemons
+       install -c -o 0 -g 0 -m 644 -p client/lib/de.barton.nagcollect \
+               /Library/LaunchDaemons/de.barton.nagcollect
+       launchctl load -w /Library/LaunchDaemons/de.barton.nagcollect
+
+.PHONY: install-client
+
+# -eof-