[Nottingham] Contab script error

Derek Huskisson derek at huskisson.free-online.co.uk
Fri Jul 16 13:54:42 BST 2004


Hello David

On Friday 16 Jul 2004 12:36, David Wolfson wrote:


> When I run the script manually it works fine.  However when cron tries to
> run it, I get an error report that the 'sweep' command can't be found. 
> 'sweep' is located in /usr/local/bin and permission are 755.
>
> I don't get it.
>
> The 'runsweep' script looks like this:
>
> #!bin/bash
> sweep -f -dn -all -p=/root/log/sweep.log /home
> and as I say, runs fine when run manually.


You can try the full path for sweep ie /usr/local/sweep in the crontab


> The line in crontab looks like this:
> 01 0 * * 0-7 root ./bin/runsweep.sh >> /root/log/sweep.log
> and appears to try to run the above script.
>
> Does cron have a different set of environment variables to root?  My guess
> would be that it's not looking for 'sweep' in /usr/local/bin..?
>
> Any suggestions please?
>
> Thanks,
>
> Dave
Or  you can put something like

# Global variables
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
MAILTO=root
HOME=/root

in your crontab file.

Vixie cron for one will accept this, don't know about the others, I suppose 
they work the same.

				Derek



More information about the Nottingham mailing list