Shell scripting woes.
Jason Taylor
jason at infinitebubble.com
Tue Feb 24 13:38:07 PST 2004
Mathias Haas wrote:
> Julien Gabel wrote:
>
>>>> Hello guys! I have two questions about shellscripts:
>>>> 2) The same backup job - is written as a bash script, and it works
>>>> perfectly when run by hand, but it won't run as a cron job.
>>>>
>>>
>>> Are you using a full path in the shebang at the top of the script?
>>> Such as:
>>>
>>> #!/bin/sh
>>> or
>>> #!/usr/local/bin/bash
>>>
>>
>>
>> And more generally, is the ${PATH} variable set correctly according
>> to all the tools/utility used along your script?
>>
>>
> As a reply to both answers, here's a script that wont' run:
> #!/usr/local/bin/bash
> echo start > test.txt
>
> ...and here is bash:
> [root at p3-550 /usr/local/etc]>> whereis bash
> bash: /usr/local/bin/bash
>
> this is /var/log/cron
> Feb 24 19:20:00 p3-550 /usr/sbin/cron[27988]: (root) CMD
> (/usr/local/etc/test.sh)
>
> This is the crontab entry:
> * * * * * /usr/local/etc/test.sh
> (At the moment, I have no shell parameters or other parameters in
> crontab, another crontab-job runs fine, but that's an executable file.)
>
>
> /mathias
>
Have you checked write permissions on whatever directory test.txt is
trying to be created in?
More information about the freebsd-questions
mailing list