POV-Ray : Newsgroups : povray.off-topic : Task scheduling? Server Time
2 Nov 2024 03:12:53 EDT (-0400)
  Task scheduling? (Message 1 to 10 of 18)  
Goto Latest 10 Messages Next 8 Messages >>>
From: Tim Cook
Subject: Task scheduling?
Date: 14 Nov 2010 07:12:56
Message: <4cdfd248$1@news.povray.org>
How would I set up task scheduler to save an internet file every 3 
hours?  I just got around to making a task that opens the URL in a new 
tab every 3 hours, but would rather it just saved the file (with 
timestamp added to filename) silently.  Had been doing this manually for 
the past three years every 24 hours, more or less (there are some gaps 
when I couldn't do it for a few days and stutters that weren't exactly 
on time), and would like a better way of accomplishing the task.

(The URL in question is 
http://xplanet.sourceforge.net/clouds/clouds_4096.jpg which updates 
every three hours...)

-- 
Tim Cook


Post a reply to this message

From: Orchid XP v8
Subject: Re: Task scheduling?
Date: 14 Nov 2010 07:30:41
Message: <4cdfd671$1@news.povray.org>
On 14/11/2010 12:12 PM, Tim Cook wrote:
> How would I set up task scheduler to save an internet file every 3
> hours? I just got around to making a task that opens the URL in a new
> tab every 3 hours, but would rather it just saved the file (with
> timestamp added to filename) silently. Had been doing this manually for
> the past three years every 24 hours, more or less (there are some gaps
> when I couldn't do it for a few days and stutters that weren't exactly
> on time), and would like a better way of accomplishing the task.
>
> (The URL in question is
> http://xplanet.sourceforge.net/clouds/clouds_4096.jpg which updates
> every three hours...)

My inclination would be to use wget to fetch the file, and a script of 
some kind to invoke wget periodically (and decide what to name the result).

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Le Forgeron
Subject: Re: Task scheduling?
Date: 14 Nov 2010 10:48:18
Message: <4ce004c2$1@news.povray.org>
Le 14/11/2010 13:30, Orchid XP v8 nous fit lire :
> On 14/11/2010 12:12 PM, Tim Cook wrote:
>> How would I set up task scheduler to save an internet file every 3
>> hours? I just got around to making a task that opens the URL in a new
>> tab every 3 hours, but would rather it just saved the file (with
>> timestamp added to filename) silently. Had been doing this manually for
>> the past three years every 24 hours, more or less (there are some gaps
>> when I couldn't do it for a few days and stutters that weren't exactly
>> on time), and would like a better way of accomplishing the task.
>>
>> (The URL in question is
>> http://xplanet.sourceforge.net/clouds/clouds_4096.jpg which updates
>> every three hours...)
> 
> My inclination would be to use wget to fetch the file, and a script of
> some kind to invoke wget periodically (and decide what to name the result).
> 
Same for me, wget & cron, done (as long as the system is up), a mv from
the same cron's line after success of the wget might be a plus, but wget
does not overwrite and rename with *.### so no problem


0 0,3,6,9,12,15,18,21 * * * /usr/bin/wget
http://xplanet.sourceforge.net/clouds/clouds_4096.jpg 2>/dev/null
1>/dev/null


Post a reply to this message

From: Darren New
Subject: Re: Task scheduling?
Date: 14 Nov 2010 12:47:04
Message: <4ce02098@news.povray.org>
Le_Forgeron wrote:
> Same for me, wget & cron, done (as long as the system is up), a mv from
> the same cron's line after success of the wget might be a plus, but wget
> does not overwrite and rename with *.### so no problem

Alternately,
wget --output-file=/home/save/blah/`date +%s`.jpg
done via cron. Then you get it named with the timestamp it was fetched 
(modulo network delays).

-- 
Darren New, San Diego CA, USA (PST)
   Serving Suggestion:
     "Don't serve this any more. It's awful."


Post a reply to this message

From: Tim Cook
Subject: Re: Task scheduling?
Date: 14 Nov 2010 18:06:22
Message: <4ce06b6e$1@news.povray.org>
On 2010-11-14 11:47, Darren New wrote:
> Le_Forgeron wrote:
>> Same for me, wget & cron, done (as long as the system is up), a mv from
>> the same cron's line after success of the wget might be a plus, but wget
>> does not overwrite and rename with *.### so no problem
>
> Alternately,
> wget --output-file=/home/save/blah/`date +%s`.jpg
> done via cron. Then you get it named with the timestamp it was fetched
> (modulo network delays).

Windows user here, and I seem to be having an issue with getting wget to 
actually save the file.  If I run 'c:\progra~1\gnuwin32\bin\wget.exe 
http://xplanet.sourceforge.net/clouds/clouds_4096.jpg' from a 
commandline it works, but if I try to add the option to save it 
somewhere it doesn't fly.  Something's off with the task scheduler, too, 
maybe...the task I made wasn't running.  Just tweaked the settings, 
maybe that'll work.

-- 
Tim Cook


Post a reply to this message

From: Tim Cook
Subject: Re: Task scheduling?
Date: 14 Nov 2010 18:34:30
Message: <4ce07206$1@news.povray.org>
Hmm.  Looks like it's working, but it's saving the files with default 
filenames...clouds_4096.jpg.1 and clouds_4096.jpg.2 and so forth, but 
I'd like the names to be better.  Hmmm.

-- 
Tim Cook
http://empyrean.freesitespace.net


Post a reply to this message

From: Darren New
Subject: Re: Task scheduling?
Date: 14 Nov 2010 20:32:43
Message: <4ce08dbb$1@news.povray.org>
Tim Cook wrote:
> Hmm.  Looks like it's working, but it's saving the files with default 
> filenames...clouds_4096.jpg.1 and clouds_4096.jpg.2 and so forth, but 
> I'd like the names to be better.  Hmmm.

You're going to need to write a .bat file or something to pluck the 
date/time into an environment variable and use it in a command to either 
rename the file or pass it on the -O argument.

date +%s

should give you seconds-since-midnight as a date, if you're comfortable with 
unixy scripting. Otherwise, I can put together a quicky .exe for you that'll 
do what you want and invoke wget or write out a .bat file or something.

-- 
Darren New, San Diego CA, USA (PST)
   Serving Suggestion:
     "Don't serve this any more. It's awful."


Post a reply to this message

From: Invisible
Subject: Re: Task scheduling?
Date: 15 Nov 2010 04:14:47
Message: <4ce0fa07$1@news.povray.org>
> Windows user here

I figured that might be the case. Still, wget is easy enough to find for 
Windows.

> and I seem to be having an issue with getting wget to
> actually save the file.

Oh. Really?

> If I run 'c:\progra~1\gnuwin32\bin\wget.exe
> http://xplanet.sourceforge.net/clouds/clouds_4096.jpg' from a
> commandline it works, but if I try to add the option to save it
> somewhere it doesn't fly.

I must admit, I do recall trying to use md5sum.exe and discovering that 
it only works for files in the current folder. I guess it dislikes 
backslashes or something. (You could try using forward slashes instead - 
not many people know this, but Windows itself does accept them.) It'll 
still break on the drive specifier, most likely.

> Something's off with the task scheduler, too,
> maybe...the task I made wasn't running. Just tweaked the settings, maybe
> that'll work.

Beware that Task Scheduler runs things under a different user account, 
with different access permissions. If I had a penny for every time a 
script has broken due to permission errors when run under Task Scheduler...


Post a reply to this message

From: Tim Cook
Subject: Re: Task scheduling?
Date: 15 Nov 2010 06:04:12
Message: <4ce113ac$1@news.povray.org>
I think I've got things sorted out, including the naming.  Well, mostly. 
  I got a batch file that puts GMT into a variable to use, so the file 
is named "clouds_4096 %date% %_gmt%.jpg" ...but the internals of the 
batch file only fix the time, not the date.  Will see if it's smart 
enough to account for that or not.  Still might have to go in and add 
checking for day/month/year rollover spots.  wget doesn't like any 
colons used in the filename, even when added from a variable, so I had 
to trim the time to hhmm instead of hh:mm.  Luckily that's what I was 
already doing...

--
Tim Cook


Post a reply to this message

From: Invisible
Subject: Re: Task scheduling?
Date: 15 Nov 2010 06:22:30
Message: <4ce117f6@news.povray.org>
On 15/11/2010 11:04 AM, Tim Cook wrote:

> wget doesn't like any colons used in the
> filename, even when added from a variable, so I had to trim the time to
> hhmm instead of hh:mm. Luckily that's what I was already doing...

As an aside, I think it's a bad idea to put colons in filenames anyway.

(And yes, variables are expended by the shell; wget can't tell the 
difference between stuff you typed in and stuff the shell expended from 
an environment variable. So if it doesn't like it when you type it, it 
won't like it when the shell types it.)


Post a reply to this message

Goto Latest 10 Messages Next 8 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.