[svlug] bash scripts and cron
Ian Kluft
ikluft at thunder.sbay.org
Fri Jan 10 13:29:28 PST 2003
>From: Robert Hajime Lanning <lanning at lanning.cc>
>On Fri, 10 Jan 2003, John McDonnell wrote:
>> It's a simple tar and scp script and it looks fine to me. This is on 5
>> different Cobalt Raqs. What happens is that tar runs fine, but the scp
>> never happens.
>>
>> Anyone able to point out the obvious? I've made sure the keypairs are
>> all happy.
>
>Make sure scp is in the path. Your /etc/profile or .profile probably
>adds the path that scp resides in. crond does not run the profiles.
>You may need to either add the path to PATH or run scp fully qualified.
Better yet, make no assumptions about the path or current directory when
writing a cron job. So either use full paths for all commands or set the
PATH within the script.
A way to test that the script is path-independent is to scuttle the PATH
variable for a test run...
PATH="" sh ./script-name
(PATH=/bin:/usr/bin would also be a realistic test for most current cron
configurations. But the harsher test above makes sure you found everything.)
Also try running it from a different directory just to make sure it's
independent of the directory you wrote it in.
More information about the svlug
mailing list