summaryrefslogtreecommitdiff
path: root/package/icinga/files
diff options
context:
space:
mode:
Diffstat (limited to 'package/icinga/files')
-rw-r--r--package/icinga/files/icinga.init35
-rw-r--r--package/icinga/files/icinga.postinst6
2 files changed, 41 insertions, 0 deletions
diff --git a/package/icinga/files/icinga.init b/package/icinga/files/icinga.init
new file mode 100644
index 000000000..239175ff2
--- /dev/null
+++ b/package/icinga/files/icinga.init
@@ -0,0 +1,35 @@
+#!/bin/sh
+#PKG icinga
+#INIT 80
+. /etc/rc.conf
+
+case $1 in
+autostop) ;;
+autostart)
+ test x"${icinga:-NO}" = x"NO" && exit 0
+ exec sh $0 start
+ ;;
+start)
+ [ -d /var/run/icinga ] || mkdir -p /var/run/icinga
+ [ -d /var/rw ] || mkdir -p /var/rw
+ [ -d /var/spool/checkresults ] || mkdir -p /var/spool/checkresults
+ touch /var/log/icinga.log
+ chown icinga:icinga /var/log/icinga.log
+ chown icinga:icinga /var/run/icinga
+ chown icinga:icinga /var/spool/checkresults
+ chown icinga:icinga /var/rw
+ icinga -d /etc/icinga/icinga.cfg
+ ;;
+stop)
+ kill $(pgrep -f /usr/bin/icinga)
+ ;;
+restart)
+ sh $0 stop
+ sh $0 start
+ ;;
+*)
+ echo "Usage: $0 {start | stop | restart}"
+ exit 1
+ ;;
+esac
+exit $?
diff --git a/package/icinga/files/icinga.postinst b/package/icinga/files/icinga.postinst
new file mode 100644
index 000000000..c0df0e7ea
--- /dev/null
+++ b/package/icinga/files/icinga.postinst
@@ -0,0 +1,6 @@
+#!/bin/sh
+. $IPKG_INSTROOT/etc/functions.sh
+add_rcconf icinga icinga NO
+gid=$(get_next_gid)
+add_group icinga $gid
+add_user icinga $(get_next_uid) $gid /etc/icinga