diff options
author | Andrew Manison <amanison@anselsystems.com> | 2010-06-19 09:02:05 +0000 |
---|---|---|
committer | Andrew Manison <amanison@anselsystems.com> | 2010-06-19 09:02:05 +0000 |
commit | 85fd77589be2f6c970ca6895afa1520e0a2fda04 (patch) | |
tree | 6b9d172b005b2657e541424da71009dcd2a1f3c4 /testing/mrtg/mrtg.initd | |
parent | 8fdcdf953f865c691b01d546a0baea1a1143deeb (diff) | |
parent | 253afa4a86bcb0959ca8b7fb269f482058847a9b (diff) | |
download | aports-85fd77589be2f6c970ca6895afa1520e0a2fda04.tar.bz2 aports-85fd77589be2f6c970ca6895afa1520e0a2fda04.tar.xz |
Merge remote branch 'alpine/master'
Conflicts:
main/openssl/APKBUILD
Diffstat (limited to 'testing/mrtg/mrtg.initd')
-rw-r--r-- | testing/mrtg/mrtg.initd | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/testing/mrtg/mrtg.initd b/testing/mrtg/mrtg.initd new file mode 100644 index 0000000000..31adb2cf0a --- /dev/null +++ b/testing/mrtg/mrtg.initd @@ -0,0 +1,53 @@ +#!/sbin/runscript +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/mrtg/files/mrtg.rc,v 1.7 2007/04/19 19:08:08 cedk Exp $ + +depend() { + need net + + # if monitoring snmp variables on this machine: + # use net-snmpd +} + +checkconfig() { + if ! [ -f "${MRTG_CONF} ]; then + eerror "Please create ${MRTG_CONF} (try man cfgmaker)" + return 1 + fi + + mrtg --check ${MRTG_CONF} + return $? +} + +start() { + # mrtg will not run if LANG=*utf8 + # use grep instead of bash regexp for bug #159786 + echo $LANG | grep -q -E '((^[A-Za-z0-9\_\@\-]+\.)|(^))([uU][tT][fF]-?8)$' && LANG='C' + + checkconfig || return $? + + # enable logging? + [ -n "${MRTG_LOG}" ] && \ + MRTG_OPTS="${MRTG_OPTS} --logging ${MRTG_LOG}" + + # run as a different user? + [ -n "${MRTG_USER}" ] && \ + MRTG_OPTS="${MRTG_OPTS} --user ${MRTG_USER}" + + # run as a different group? + [ -n "${MRTG_GROUP}" ] && \ + MRTG_OPTS="${MRTG_OPTS} --group ${MRTG_GROUP}" + + ebegin "Starting mrtg" + start-stop-daemon --start --quiet --pidfile ${MRTG_PID} --name mrtg\ + --exec /usr/bin/mrtg -- --daemon --pid-file=${MRTG_PID} \ + ${MRTG_OPTS} ${MRTG_CONF} >/dev/null + eend $? "Failed to start mrtg" +} + +stop() { + ebegin "Stopping mrtg" + start-stop-daemon --stop --quiet --pidfile ${MRTG_PID} + eend $? "Failed to stop mrtg" +} |