Ubuntu – Weekly Cron / Logrotate / Denyhosts error

crondenyhostslogrotateUbuntu

I am getting the following error email every week. It appears to be a problem with either cron, logrotate, or denyhosts. I'm not sure which.

Subject: Cron <root@vps> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )

/etc/cron.daily/logrotate:
test: 91: /etc/hosts.deny: unexpected operator

Any suggestions?

Best Answer

/etc/logrotate.d/denyhosts is very short and doesn't seem to me to use test:

Yes, but it has this:

postrotate
/etc/init.d/denyhosts restart > /dev/null
endscript

and that script does stuff like

    HOSTS_DENY=$(grep ^HOSTS_DENY $CONFIG  | cut -d = -f 2)
    test -e $HOSTS_DENY || touch $HOSTS_DENY

assuming the script is correct, if I had to guess I'd say your HOSTS_DENY line in your config file is malformed somehow.

Fortunately, we don't have to guess, this command will show you exactly where the error is coming from:

/bin/sh -x /etc/init.d/denyhosts restart
Related Topic