Re: LiveCode equivalent to 'cron' for automated background functions?

2018-11-30 Thread Sannyasin Brahmanathaswami via use-livecode
Been using LC scripts on the server for "like 20 years."  

But run on the cron of the server itself.  

Brahmanathaswami
 

On 11/30/18, 2:37 AM, "use-livecode on behalf of Keith Clarke via 
use-livecode"  wrote:

Thanks Andre - good call. 
Following others’ reminders of the single-threaded nature of LCS, I’m 
trying to rethink data flows as on-demand, to avoid all background tasks.
Best,
Keith

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LiveCode equivalent to 'cron' for automated background functions?

2018-11-30 Thread Keith Clarke via use-livecode
Thanks Andre - good call. 
Following others’ reminders of the single-threaded nature of LCS, I’m trying to 
rethink data flows as on-demand, to avoid all background tasks.
Best,
Keith

> On 30 Nov 2018, at 12:10, Andre Alves Garzia via use-livecode 
>  wrote:
> 
> Keith,
> 
> 
>> The examples in the dictionary look potentially useful for a couple of 
>> lightweight activities I’d like to have ticking-over in the background on my 
>> LC Server, pending page visits.
> 
> You shouldn't have the CGI engine hogging up like that, thats not how web 
> stuff is supposed to work. First, Apache (or whatever you're running) will 
> kill the process after some seconds if it fails to exit on its own. Second, 
> it is a waste of resources. Imagine that you have this running for every 
> request that is made, so each time a user requests your site, your LC Server 
> engine hangs in the background for a while, hogging up system resources.
> 
> LC Servers should reply as fast as possible and then exit. If you need a long 
> running process to do some administrative stuff regularly, then, consider 
> building a little script and running that as a real proper cronjob on the 
> server, not tied to visits.
> 
> Cheers
> 
> andre
> 
> 
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LiveCode equivalent to 'cron' for automated background functions?

2018-11-30 Thread Andre Alves Garzia via use-livecode

Keith,



The examples in the dictionary look potentially useful for a couple of 
lightweight activities I’d like to have ticking-over in the background on my LC 
Server, pending page visits.


You shouldn't have the CGI engine hogging up like that, thats not how 
web stuff is supposed to work. First, Apache (or whatever you're 
running) will kill the process after some seconds if it fails to exit on 
its own. Second, it is a waste of resources. Imagine that you have this 
running for every request that is made, so each time a user requests 
your site, your LC Server engine hangs in the background for a while, 
hogging up system resources.


LC Servers should reply as fast as possible and then exit. If you need a 
long running process to do some administrative stuff regularly, then, 
consider building a little script and running that as a real proper 
cronjob on the server, not tied to visits.


Cheers

andre




___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LiveCode equivalent to 'cron' for automated background functions?

2018-11-29 Thread Mike Kerner via use-livecode
@tom
Yeah, that was a nifty demonstration of how to get around
single-threadedness, especially after Mark and I had been talking about
that very topic for a week or so.  I was thinking that it would be cool to
attach various LC externals and libraries to make a robust way to implement
some better fault tolerance.

On Thu, Nov 29, 2018 at 3:49 AM Keith Clarke via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Thanks for the really useful responses Richard, Alex & Tom - great to know
> the art of the possible.
> I think most of my current use cases will be supported by send with time,
> as they’re more lightweight ’tick-over’ activities than big batch jobs.
> Best,
> Keith
>
> > On 28 Nov 2018, at 21:51, Richard Gaskin via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >
> > Alex Tweedly wrote:
> >
> > > On 28/11/2018 20:45, Richard Gaskin via use-livecode wrote:
> > >>
> > >> 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.
> > >>
> > > And. conversely, you can drive LC from cron - i.e. to schedule
> > > something regular, just use cron, and make the cron task be something
> > > like
> > >
> > > wget https://mydomain.com/index.lc/domynightlytask
> > >
> > > so you get to script the task in your usual way (e.g. within
> > > revigniter), and do the scheduling with cron (generally accessible
> > > from cPanel as well as shell).
> >
> > And for local tasks:
> >
> >   ~/somescript.lc
> >
> > ...where line 1 of somescript.lc is:
> >
> > #!/path/to/your/copy/of/livecodeserver
> >
> >
> > Or launch the engine and specify the script in the command line:
> >
> > ~/livecode-server  somescript.lc
> >
> >
> > Lots of flexibility mixing and matching LC with other tools to make the
> best use of what each brings to the table.
> >
> > --
> > Richard Gaskin
> > Fourth World Systems
> > Software Design and Development for the Desktop, Mobile, and the Web
> > 
> > ambassa...@fourthworld.comhttp://www.FourthWorld.com
> >
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LiveCode equivalent to 'cron' for automated background functions?

2018-11-29 Thread Keith Clarke via use-livecode
Thanks for the really useful responses Richard, Alex & Tom - great to know the 
art of the possible.
I think most of my current use cases will be supported by send with time, as 
they’re more lightweight ’tick-over’ activities than big batch jobs.
Best,
Keith

> On 28 Nov 2018, at 21:51, Richard Gaskin via use-livecode 
>  wrote:
> 
> Alex Tweedly wrote:
> 
> > On 28/11/2018 20:45, Richard Gaskin via use-livecode wrote:
> >>
> >> 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.
> >>
> > And. conversely, you can drive LC from cron - i.e. to schedule
> > something regular, just use cron, and make the cron task be something
> > like
> >
> > wget https://mydomain.com/index.lc/domynightlytask
> >
> > so you get to script the task in your usual way (e.g. within
> > revigniter), and do the scheduling with cron (generally accessible
> > from cPanel as well as shell).
> 
> And for local tasks:
> 
>   ~/somescript.lc
> 
> ...where line 1 of somescript.lc is:
> 
> #!/path/to/your/copy/of/livecodeserver
> 
> 
> Or launch the engine and specify the script in the command line:
> 
> ~/livecode-server  somescript.lc
> 
> 
> Lots of flexibility mixing and matching LC with other tools to make the best 
> use of what each brings to the table.
> 
> -- 
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> 
> ambassa...@fourthworld.comhttp://www.FourthWorld.com
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LiveCode equivalent to 'cron' for automated background functions?

2018-11-28 Thread Tom Glod via use-livecode
I did a multi-core processing presentation with livecode at the global
conference.

running long shell commands is one of the use cases for such a setup.

https://github.com/makeshyft-tom-g/livecode-multicore-library

might be an option here.

On Wed, Nov 28, 2018 at 5:20 PM Richard Gaskin via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Alex Tweedly wrote:
>
>  > On 28/11/2018 20:45, Richard Gaskin via use-livecode wrote:
>  >>
>  >> 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.
>  >>
>  > And. conversely, you can drive LC from cron - i.e. to schedule
>  > something regular, just use cron, and make the cron task be something
>  > like
>  >
>  > wget https://mydomain.com/index.lc/domynightlytask
>  >
>  > so you get to script the task in your usual way (e.g. within
>  > revigniter), and do the scheduling with cron (generally accessible
>  > from cPanel as well as shell).
>
> And for local tasks:
>
> ~/somescript.lc
>
> ...where line 1 of somescript.lc is:
>
> #!/path/to/your/copy/of/livecodeserver
>
>
> Or launch the engine and specify the script in the command line:
>
> ~/livecode-server  somescript.lc
>
>
> Lots of flexibility mixing and matching LC with other tools to make the
> best use of what each brings to the table.
>
> --
>   Richard Gaskin
>   Fourth World Systems
>   Software Design and Development for the Desktop, Mobile, and the Web
>   
>   ambassa...@fourthworld.comhttp://www.FourthWorld.com
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: LiveCode equivalent to 'cron' for automated background functions?

2018-11-28 Thread Richard Gaskin via use-livecode

Alex Tweedly wrote:

> On 28/11/2018 20:45, Richard Gaskin via use-livecode wrote:
>>
>> 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.
>>
> And. conversely, you can drive LC from cron - i.e. to schedule
> something regular, just use cron, and make the cron task be something
> like
>
> wget https://mydomain.com/index.lc/domynightlytask
>
> so you get to script the task in your usual way (e.g. within
> revigniter), and do the scheduling with cron (generally accessible
> from cPanel as well as shell).

And for local tasks:

   ~/somescript.lc

...where line 1 of somescript.lc is:

#!/path/to/your/copy/of/livecodeserver


Or launch the engine and specify the script in the command line:

~/livecode-server  somescript.lc


Lots of flexibility mixing and matching LC with other tools to make the 
best use of what each brings to the table.


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: LiveCode equivalent to 'cron' for automated background functions?

2018-11-28 Thread Alex Tweedly via use-livecode

On 28/11/2018 20:45, Richard Gaskin via use-livecode wrote:



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.


And. conversely, you can drive LC from cron - i.e. to schedule something 
regular, just use cron, and make the cron task be something like


wget https://mydomain.com/index.lc/domynightlytask

so you get to script the task in your usual way (e.g. within 
revigniter), and do the scheduling with cron (generally accessible from 
cPanel as well as shell).


Alex.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LiveCode equivalent to 'cron' for automated background functions?

2018-11-28 Thread Richard Gaskin via use-livecode

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  in " 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
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LiveCode equivalent to 'cron' for automated background functions?

2018-11-28 Thread Mike Kerner via use-livecode
oh, yeah, and have a look at waitDepth

On Wed, Nov 28, 2018 at 12:43 PM Keith Clarke via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Thanks Mike, I was aware of ‘do’ but hadn’t used ’send’, so not seen its
> timer aspect.
>
> The examples in the dictionary look potentially useful for a couple of
> lightweight activities I’d like to have ticking-over in the background on
> my LC Server, pending page visits.
> Best,
> Keith
>
> > On 28 Nov 2018, at 17:30, Mike Kerner via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >
> > In the meantime, there are two commands to have a look at if you want to
> > have a crack at rolling your own
> > send and do
> > send "doSomething" to me in 60 seconds
> > then there is a way to see if you're interrupting an asynchronous
> activity
> > pendingMessages
> >
> > On Wed, Nov 28, 2018 at 12:02 PM Mike Kerner 
> > wrote:
> >
> >> LC is single-threaded so CRON is a little tricky.  I have code that
> works
> >> with those limitations.  I suppose I should repo it.  Some day I might
> even
> >> get the secondary process part working.
> >>
> >> On Wed, Nov 28, 2018 at 11:15 AM Keith Clarke via use-livecode <
> >> use-livecode@lists.runrev.com> wrote:
> >>
> >>> Folks,
> >>> 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
> >>>
> >>> Thanks
> >>> Keith
> >>>
> >>>
> >>>
> >>> ___
> >>> use-livecode mailing list
> >>> use-livecode@lists.runrev.com
> >>> Please visit this url to subscribe, unsubscribe and manage your
> >>> subscription preferences:
> >>> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>
> >>
> >>
> >> --
> >> On the first day, God created the heavens and the Earth
> >> On the second day, God created the oceans.
> >> On the third day, God put the animals on hold for a few hours,
> >>   and did a little diving.
> >> And God said, "This is good."
> >>
> >
> >
> > --
> > On the first day, God created the heavens and the Earth
> > On the second day, God created the oceans.
> > On the third day, God put the animals on hold for a few hours,
> >   and did a little diving.
> > And God said, "This is good."
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LiveCode equivalent to 'cron' for automated background functions?

2018-11-28 Thread Keith Clarke via use-livecode
Thanks Mike, I was aware of ‘do’ but hadn’t used ’send’, so not seen its timer 
aspect.

The examples in the dictionary look potentially useful for a couple of 
lightweight activities I’d like to have ticking-over in the background on my LC 
Server, pending page visits.  
Best,
Keith 

> On 28 Nov 2018, at 17:30, Mike Kerner via use-livecode 
>  wrote:
> 
> In the meantime, there are two commands to have a look at if you want to
> have a crack at rolling your own
> send and do
> send "doSomething" to me in 60 seconds
> then there is a way to see if you're interrupting an asynchronous activity
> pendingMessages
> 
> On Wed, Nov 28, 2018 at 12:02 PM Mike Kerner 
> wrote:
> 
>> LC is single-threaded so CRON is a little tricky.  I have code that works
>> with those limitations.  I suppose I should repo it.  Some day I might even
>> get the secondary process part working.
>> 
>> On Wed, Nov 28, 2018 at 11:15 AM Keith Clarke via use-livecode <
>> use-livecode@lists.runrev.com> wrote:
>> 
>>> Folks,
>>> 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
>>> 
>>> Thanks
>>> Keith
>>> 
>>> 
>>> 
>>> ___
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> 
>> --
>> On the first day, God created the heavens and the Earth
>> On the second day, God created the oceans.
>> On the third day, God put the animals on hold for a few hours,
>>   and did a little diving.
>> And God said, "This is good."
>> 
> 
> 
> -- 
> On the first day, God created the heavens and the Earth
> On the second day, God created the oceans.
> On the third day, God put the animals on hold for a few hours,
>   and did a little diving.
> And God said, "This is good."
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LiveCode equivalent to 'cron' for automated background functions?

2018-11-28 Thread Mike Kerner via use-livecode
In the meantime, there are two commands to have a look at if you want to
have a crack at rolling your own
send and do
send "doSomething" to me in 60 seconds
then there is a way to see if you're interrupting an asynchronous activity
pendingMessages

On Wed, Nov 28, 2018 at 12:02 PM Mike Kerner 
wrote:

> LC is single-threaded so CRON is a little tricky.  I have code that works
> with those limitations.  I suppose I should repo it.  Some day I might even
> get the secondary process part working.
>
> On Wed, Nov 28, 2018 at 11:15 AM Keith Clarke via use-livecode <
> use-livecode@lists.runrev.com> wrote:
>
>> Folks,
>> 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
>>
>> Thanks
>> Keith
>>
>>
>>
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
>
> --
> On the first day, God created the heavens and the Earth
> On the second day, God created the oceans.
> On the third day, God put the animals on hold for a few hours,
>and did a little diving.
> And God said, "This is good."
>


-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LiveCode equivalent to 'cron' for automated background functions?

2018-11-28 Thread Mike Kerner via use-livecode
LC is single-threaded so CRON is a little tricky.  I have code that works
with those limitations.  I suppose I should repo it.  Some day I might even
get the secondary process part working.

On Wed, Nov 28, 2018 at 11:15 AM Keith Clarke via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Folks,
> 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
>
> Thanks
> Keith
>
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

LiveCode equivalent to 'cron' for automated background functions?

2018-11-28 Thread Keith Clarke via use-livecode
Folks,
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

Thanks
Keith



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode