Why crontab is not able to run some commands ?

Duane Hill d.hill at yournetplus.com
Fri May 11 19:29:36 UTC 2007


On Fri, 11 May 2007, Halid Faith wrote:

>
> I have a script. As I am a root user,  I can run it without a problem. I
> added that script to crontab in order to run as automatic.
> I entered in /etc/crontab and put down as below;
> */20     *       *       *       *       root    /etc/scriptfile
>
> Despite root user, the crontab could not run above file. But I can run the
> same script in command line interface.
> I am sure tha the crontab daemon is running. Also I can see the crontab try
> to run that script in /var/log/cron.
> /usr/sbin/cron[98727]: (root) CMD (/etc/scriptfile)
> When I am a different user, I couldn't run the script and I got "access
> denied"
> What is the problem ?

Were you either logged in as root or su'd to root when you ran the script? 
If so, why not just install the cron as root by:

% crontab -u root -e

The only change to your cron line you would have to make is to drop the 
username 'root'. So it would look like:

*/20     *       *       *       *       /etc/scriptfile


More information about the freebsd-questions mailing list