I recently experienced a logwatch issue that is fixed by running export DATE_MANIP=DM5. cron seems to forget this when I logout (presumably because it's not saved).

Where can I add this custom environment variable? Since I don't manage the code for logwatch, I don't want to necessarily add an export command inside the script that launches. I tried adding export DATE_MANIP=DM5 to /root/.bash_profile but that doesn't help when I'm not logged in.

CentOS 6.x


Edit your /etc/cron.daily/0logwatch script, and add the export DATE_MANIP=DM5 before the logwatch call.



#Set logwatch location
#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

#Call logwatch

exit 0

look into BASH_ENV http://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/

try checking out https://stackoverflow.com/questions/6063618/bash-env-or-sourcing-a-file-in-a-non-interactive-non-login-shell

  • That's not going to help: to set the DATE_MANIP environment variable, you'd need to set the BASH_ENV environment variable, which is the same problem. And even if you did set BASH_ENV, it would have no effect on an sh script. – Gilles 'SO- stop being evil' Mar 28 '14 at 23:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.