Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 May 2007 19:29:35 +0000 (UTC)
From:      Duane Hill <d.hill@yournetplus.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Why crontab is not able to run some commands ?
Message-ID:  <20070511192554.L20096@duane.dbq.yournetplus.com>
In-Reply-To: <002001c793fd$a789bfa0$dc96eed5@ihlasnetym>
References:  <002001c793fd$a789bfa0$dc96eed5@ihlasnetym>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070511192554.L20096>