Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

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
share|improve this answer

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

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

share|improve this answer
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 Mar 28 '14 at 23:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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