LiveCode equivalent to 'cron' for automated background functions?

Richard Gaskin ambassador at fourthworld.com
Wed Nov 28 15:45:38 EST 2018


Keith Clarke wrote:
 > Please can anyone steer me towards the dictionary keyword equivalent
 > to ‘cron' jobs for initiating time-based background functions, along
 > the lines of…
 >
 > on TimeAt pHour pMinute pSecond
 >         do stuff
 > end TimeAt

You can do it with LC, but not as a CGI, as LC Server is most commonly 
used.  CGIs boot a scripting engine, the engine processes the request, 
sends a reply, and dies, each time it's called.  Keeps things simple and 
discrete, but isn't well suited for an always-on process like a cron 
substitute.

Shared hosts generally don't allow always-on processes, but if you're 
running on a VPS or dedicated box you have the freedom to do anything 
you want.  For such cases "send <msg> in <time>" works well, if you set 
up the process to boot with the machine and build a means of interacting 
with it while it's running.

If you've seen LiveNet you've seen it in action: I have a box in the 
corner of my office that aggregates RSS feeds for our community and 
packages them up and posts the result to a public server for display in 
LiveNet.  It's been running every few minutes without interruption for 
years.

But I did it only because it was a fun exercise at the time, and if I 
had to do it over again I'd just use cron - simpler, leaner, more portable.

FWIW, cron is for periodic tasks.  If you need a one-off at a specific 
time see at.

But can be managed from the command line, which means you can drive them 
from LC if needed through the shell function.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list