tags 617898 - moreinfo
thanks

I can duplicate this bug in squeeze.

It happens if you remove "logrotate" from /etc/cron.daily, and instead
put something like this in a new file at "/etc/cron.d/logrotate":

20 04 * * * root /usr/sbin/logrotate /etc/logrotate.conf

This causes errors like "logrotate_script: 2: invoke-rc.d: not found".

The reason this happens is that when scripts are run from /etc/cron.d,
the default $PATH is:

/usr/bin:/bin

But when they're run from /etc/cron.daily, the default $PATH is:

/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

This, in turn, is because /etc/crontab contains this line before
"run-parts --report /etc/cron.daily":

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

That changes the $PATH for cron.daily (and cron.hourly, cron.weekly, and
cron.monthly)... but there is no such path override for scripts running
from /etc/cron.d.

The simple solution to the original person's problem is to add this to
his /etc/cron.d/logrotate script:

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

However, I was a little surprised to find that the default $PATH is
different for scripts run from /etc/cron.d and /etc/cron.daily. Although
it's unlikely, a misunderstanding about that could perhaps cause someone
to make a security-related mistake.

-- 
Robert L Mathews, Tiger Technologies, http://www.tigertech.net/ 


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to