
나는 최근에로그 모니터링 문제이 문제는 를 실행하여 해결되었습니다 export DATE_MANIP=DM5
. cron은 로그아웃할 때 이것을 잊어버린 것 같습니다(아마도 저장하지 않기 때문일 것입니다).
이 사용자 정의 환경 변수를 어디에 추가할 수 있나요? 저는 로그워치 코드를 관리하지 않기 때문에 export
시작되는 스크립트에 명령어를 추가하고 싶지 않습니다 . 추가 export DATE_MANIP=DM5
를 시도했지만 /root/.bash_profile
로그인하지 않은 경우에는 도움이 되지 않습니다.
센트OS 6.x
답변1
스크립트를 편집하고 /etc/cron.daily/0logwatch
Logwatch 호출 전에 추가하세요.export DATE_MANIP=DM5
예:
#!/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