[REBOL] Automation query... Re:

2000-07-06 Thread icimjs

Hi TBrownell,

you wrote:
Hi.

What is the best way to run a script on a timer basis?

I have a script that that fires off another that
checks a pop account every minute and then runs any
scripts it finds. 

This is a bit thick, but it works...

N: repeat 100 [wait 60 do %popreader.r]

You can use forever, i.e.

forever [ wait 60 do %popreader.r ]


This is lacking as...

A. If it hits an error it stalls.

use try, i.e.

forever [
  wait 60
  if error? set/any 'error try [ do %popreader.r ] [
date: replace form now "/" "-"
logfile: to file! join "error-" [date ".log"]
save logfile mold disarm error
  ]
]

(this will log each error into its own file called error-date-time.log)
and - more importantly - it should continue executing.

  
B. It picks up values from all the scripts it
generates via email

That I don't understand. Where are these values coming from? Remember,
REBOL does garbage collection, so I would assume - depending on how
popreader.r is written - that old values are garbage collected whenever you
rerun popreader.r, because popreader.r will reuse the same words it used
previously. When the words are reused the old values become orphaned and
are garbage collected. So you shouldn't be accumulating any garbage. But
then again, I haven't seen popreader's source, so what do I know?

In any event, it should be possible to write popreader.r in such a way that
you don't accumulate stuff over several runs.

Hope this helps,


;- Elan [ : - ) ]




[REBOL] Automation query... Re:

2000-07-06 Thread icimjs

Hi,

I just noticed that Windows has a problem with colons in file names. This
should work better if you're running under MS Windows (under linux, you can
disregard the modification):

REBOL []

forever [
  wait 60
  if error? set/any 'error try [ do %popreader.r ] [
date: replace form now "/" "-"
date: replace/all date ":" "."
logfile: to file! join "error-" [date ".log"]
save logfile mold disarm error
  ]
]



;- Elan [ : - ) ]