aboutsummaryrefslogtreecommitdiff
path: root/sysutils/munin-node/pkg-install
diff options
context:
space:
mode:
authorSergey Matveychuk <sem@FreeBSD.org>2005-03-04 17:47:19 +0000
committerSergey Matveychuk <sem@FreeBSD.org>2005-03-04 17:47:19 +0000
commita42946364e48019305444cc806a513c7f24cb6dd (patch)
tree2961babd96673fb1b28cebf7be0bbf9567315f8b /sysutils/munin-node/pkg-install
parent7efa776763e3de0c2d3d0eb87fe058a1b0f17ada (diff)
Notes
Diffstat (limited to 'sysutils/munin-node/pkg-install')
-rw-r--r--sysutils/munin-node/pkg-install47
1 files changed, 39 insertions, 8 deletions
diff --git a/sysutils/munin-node/pkg-install b/sysutils/munin-node/pkg-install
index 09c169bf6b14..95d53640dba0 100644
--- a/sysutils/munin-node/pkg-install
+++ b/sysutils/munin-node/pkg-install
@@ -1,10 +1,4 @@
#! /bin/sh
-#
-# $Log: pkg-install,v $
-# Revision 1.2 2004/02/06 18:49:58 lupe
-# Fixes for pkg_add compatibility.
-#
-#
ask() {
local question default answer
@@ -63,8 +57,6 @@ init_plugins() {
prevver=$(cat ${PKG_PREFIX}/etc/munin/VERSION.node)
fi
- mkdir -p ${PKG_PREFIX}/etc/munin/plugins ${PKG_PREFIX}/var/munin/plugin-state
-
if [ -n "$prevver" ]; then
echo -n "Initializing new plugins.."
${PKG_PREFIX}/sbin/munin-node-configure --shell --newer "${prevver%-*}" | sh -x
@@ -75,6 +67,43 @@ init_plugins() {
echo "done."
}
+create_crontab_entries() {
+ local sched prog
+ sched=$1
+ prog=$2
+
+ if grep -q "^[^#]*$prog" /etc/crontab; then
+ echo "It looks like your crontab is already set up, so I'll use that."
+ else
+ echo "It looks like your perl suffers from unsafe signals."
+ if yesno "Would you like me to set up your root crontab to restart munin-node" y; then
+ cat <<EOT >>/etc/crontab
+$sched root $prog
+EOT
+ else
+ echo "You may suffer from munin-node crashing after log rotation."
+ echo "If you still want to restart munin-node, use $prog."
+ fi
+ fi
+}
+
+newsyslog() {
+ if yesno "Would you like me to set up log rotation" y; then
+ if grep -q /var/log/munin-node.log /etc/newsyslog.conf; then
+ :
+ else
+ cat >> /etc/newsyslog.conf <<EOT
+/var/log/munin-node.log 644 7 * @T00 Z /var/run/munin/munin-node.pid
+EOT
+ fi
+ if [ -f ${PKG_PREFIX}/bin/munin-node-revive ]; then
+ create_crontab_entries '4 * * * *' ${PKG_PREFIX}/bin/munin-node-revive
+ fi
+ else
+ echo "/var/log/munin-node.log will grow without bounds."
+ fi
+}
+
########################################################################
@@ -84,5 +113,7 @@ case $2 in
;;
POST-INSTALL)
init_plugins
+ ${PKG_PREFIX}/etc/rc.d/munin-node.sh start
+ newsyslog
;;
esac