| 1 |
#!/sbin/runscript |
| 2 |
# Copyright 1999-2012 Gentoo Foundation |
| 3 |
# Distributed under the terms of the GNU General Public License v2 |
| 4 |
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/munin/files/munin-node_init.d_2.0.2,v 1.1 2012/07/16 16:15:11 flameeyes Exp $ |
| 5 |
|
| 6 |
get_munin_config() { |
| 7 |
awk '$1 == "'$1'" { s=$2 } END { print s }' "$CFGFILE" |
| 8 |
} |
| 9 |
|
| 10 |
: ${CFGFILE:=/etc/munin/munin-node.conf} |
| 11 |
: ${PIDFILE:=$(get_munin_config pid_file)} |
| 12 |
: ${NICE_LEVEL:=0} |
| 13 |
|
| 14 |
depend() { |
| 15 |
config "$CFGFILE" |
| 16 |
|
| 17 |
need net |
| 18 |
before cron |
| 19 |
|
| 20 |
[ "$(get_munin_config log_file)" == "Sys::Syslog" ] && \ |
| 21 |
use logger |
| 22 |
} |
| 23 |
|
| 24 |
start() { |
| 25 |
checkpath -d -o munin:munin -m 0700 $(dirname ${PIDFILE}) |
| 26 |
|
| 27 |
ebegin "Starting Munin node" |
| 28 |
start-stop-daemon --start \ |
| 29 |
--nicelevel $NICE_LEVEL \ |
| 30 |
--pidfile $PIDFILE \ |
| 31 |
--exec /usr/sbin/munin-node -- --config "$CFGFILE" |
| 32 |
eend $? |
| 33 |
} |
| 34 |
|
| 35 |
stop() { |
| 36 |
ebegin "Stopping Munin node" |
| 37 |
start-stop-daemon --stop --pidfile $PIDFILE |
| 38 |
eend $? |
| 39 |
} |
| 40 |
|
| 41 |
# vim: filetype=gentoo-init-d: |