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