
Recentemente experimentei umaproblema de logwatchisso é corrigido executando export DATE_MANIP=DM5
. cron parece esquecer isso quando eu saio (presumivelmente porque não está salvo).
Onde posso adicionar esta variável de ambiente personalizada? Como não gerencio o código do logwatch, não quero necessariamente adicionar um export
comando dentro do script que é iniciado. Tentei adicionar export DATE_MANIP=DM5
, /root/.bash_profile
mas isso não ajuda quando não estou logado.
CentOS 6.x
Responder1
Edite seu /etc/cron.daily/0logwatch
script e adicione export DATE_MANIP=DM5
antes da chamada do logwatch.
exemplo:
#!/bin/sh
#Set logwatch location
LOGWATCH_SCRIPT="/usr/sbin/logwatch"
#Add options to this line. Most options should be defined in /etc/logwatch/conf/logwatch.conf,
#but some are only for the nightly cronrun such as --output mail and should be set here.
#Other options to consider might be "--format html" or "--encode base64", man logwatch for more details.
OPTIONS="--output mail"
# Fix Date::Manip issue
export DATE_MANIP=DM5
#Call logwatch
$LOGWATCH_SCRIPT $OPTIONS
exit 0