If LANG is set to utf8, then the init.d script starts, but mrtg quits. The init.d script still says "started". Zapping is needed. Add: LANG=C export LANG to /etc/init.d/mrtg.
mrtg will not work properly if LANG=utf8 (see http://gentoo-wiki.com/HOWTO_SNMP_and_MRTG_Made_Easy#UTF-8). The file /etc/init.d/mrtg coming with the version 2.11.1 does include the following line at the beginning of the start function: [[ "${LANG}" == *[uU][tT][fF]?8 ]] && LANG='C' so it will never start with LANG=utf8.
The line is not working. I still get the UTF-error dialog of mrtg. I had to add LANG at the topmost. Probably, the line is buggy, or it is not working. I pasted my mods: # 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.3 2005/06/19 18:24:49 vanquirius Exp $ depend() { need net # if monitoring snmp variables on this machine: # use net-snmpd } LANG=C export LANG 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 [[ "${LANG}" == *[uU][tT][fF]?8 ]] && LANG='C' checkconfig || return $? ... cut ...
Here is my setting of LANG: echo $LANG en_US.utf8 Probably, the language string has changed and does not match the pattern anymore.
Created attachment 86444 [details, diff] patch for files/mrtg.rc This reg. exp. should fit for all the needed cases: [[ "${LANG}" == *[uU][tT][fF]8 ]] && LANG='C'
If I look at what is possible to set the LANG variable to on my Gentoo machine: jum@shadow ~ $ locale -a C POSIX de_DE de_DE.utf8 de_DE@euro de_DE@euro.UTF-8 en_US en_US.utf8 jum@shadow ~ $ locale -m |grep -i utf UTF-8 then an optional dash between utf and 8 should be allowed as well.
Created attachment 86464 [details, diff] patch for "files/mrtg.rc" This reg. exp. should work better ;) [[ "${LANG}" =~ '((^[A-Za-z0-9\_\@\-]+\.)|(^))([uU][tT][fF]-?8)$' ]]
Created attachment 86465 [details, diff] patch for "files/mrtg.rc" This reg. exp. should work better ;) [[ "${LANG}" =~ '((^[A-Za-z0-9\_\@\-]+\.)|(^))([uU][tT][fF]-?8)$' ]]
Comment on attachment 86444 [details, diff] patch for files/mrtg.rc new reg. exp. produced.
Angelo, I've heard a-z is bad in regex as it doesn't include the entire language in some alphabets (e.g. ethopian) Is [[:alphanum:]] or something possible?
ignore previous comment. fixed in 2.13.2-r2 thanks Angelo