Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jun 2011 14:44:29 -0700
From:      Kurt Buff <kurt.buff@gmail.com>
To:        FreeBSD Questions <questions@freebsd.org>
Subject:   Re: Probably working too hard for this cron question
Message-ID:  <BANLkTikJLpb-PQKWbuyX1F7GWzW1jMpirA@mail.gmail.com>
In-Reply-To: <BANLkTinCFMqGBx0jkbRH-J03wNkQaPOo7Q@mail.gmail.com>
References:  <BANLkTimD4DaYtvDmiJ4=qaj3CNsKr=XHNQ@mail.gmail.com> <BANLkTinCFMqGBx0jkbRH-J03wNkQaPOo7Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jun 13, 2011 at 13:25, pete wright <nomadlogic@gmail.com> wrote:
> On Mon, Jun 13, 2011 at 12:52 PM, Kurt Buff <kurt.buff@gmail.com> wrote:
>> All,
>>
>> I've googled a bunch, read some freebsd.org docs, and just can't
>> figure this out.
>>
>> I have a script that should read the current date into a variable,
>> append the time/date stamp at the beginning of the file created with
>> the date in the variable, do a bunch of cURL stuff, then append a
>> time/date stamp at the end of the file.
>>
>> It works if I run it manually, but not from cron.
>>
>> Here are the batchfile and the cron entry:
>>
>> ----------begin script----------
>> dt=3D`/bin/date "+%Y-%m-%d"`
>> /bin/date > /root/$dt-external1.txt
>> /usr/local/bin/curl -K /root/urls.txt >> /root/$dt-external1.txt
>> /bin/date >> /root/$dt-external1.txt
>> ----------end script----------
>>
>> ----------begin crontab----------
>> 15 12 * * * =C2=A0 =C2=A0 =C2=A0 =C2=A0/root/do-curl.sh
>> ----------end crontab----------
>>
>> I'm doing all of this as root, as you can see.
>>
>> The job launches - I can see an entry for cURL in top - but no file in /=
root.
>>
>> I've tried several variations on the first line of the script, but I'm
>> getting nowhere, though I'm sure it's something stupidly simple that
>> I'm missing.
>>
>> What am I missing?
>
> #!/bin/sh ?

Definitely closer...

Per the handbook, I added

     SHELL=3D/bin/sh

to crontab, and I also added

     #!/bin/sh

as the first line in the script

But, while a file is being created, it's just

     /root/-external1.txt

not

     /root/2011-06-13-external1.txt

Kurt



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