SstCronEntry setup

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

SstCronEntry setup

jtuchel
Dear VAST community,

I just was a little surprised by the behaviour or SstCron. It was just a matter of a couple of minutes to find the solution, but I wanted to share it here.

I wanted to set up a daemon that does some logging of system state (AbxProcessPeakDumper - thanks John for this Goodie!) every minute.

So I set up a Cron job like this:

SstCron default add: (
        SstCronEntry new
            workBlock: [KontolinoHeartbeat default beat];
            minutes: 1).


What surprised me is that this job runs every second.
In fact, you have to explicitly set the seconds. But it's not absolutely obvious that you cannot simply set seconds to zero.
You actually need to set the cron job up like this:

SstCron default add: (
        SstCronEntry new
            workBlock: [KontolinoHeartbeat default beat];
            minutes: 1;
seconds: #(0)
).

in order to have it run at exactly at second zero of every minute.

Maybe this is old hats to most of you, but I had to spend three minutes on this ;-) Not sure I want to suggest a change to it.
My first thought was that if I say; "every 1 minute please" and don't talk about seconds, it means exactly every 1 minute.
Only if I want to think about seconds, I want SstCron to tinker with seconds...

Any opinions? Is the implemented behaviour in line with Unix' cron?


Joachim

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: SstCronEntry setup

Richard Sargent
Administrator
On Thursday, March 30, 2017 at 12:55:51 AM UTC-7, Joachim Tuchel wrote:
Dear VAST community,

I just was a little surprised by the behaviour or SstCron. It was just a matter of a couple of minutes to find the solution, but I wanted to share it here.

I wanted to set up a daemon that does some logging of system state (AbxProcessPeakDumper - thanks John for this Goodie!) every minute.

So I set up a Cron job like this:

SstCron default add: (
        SstCronEntry new
            workBlock: [KontolinoHeartbeat default beat];
            minutes: 1).


What surprised me is that this job runs every second.
In fact, you have to explicitly set the seconds. But it's not absolutely obvious that you cannot simply set seconds to zero.
You actually need to set the cron job up like this:

SstCron default add: (
        SstCronEntry new
            workBlock: [KontolinoHeartbeat default beat];
            minutes: 1;
seconds: #(0)
).

in order to have it run at exactly at second zero of every minute.

Maybe this is old hats to most of you, but I had to spend three minutes on this ;-) Not sure I want to suggest a change to it.
My first thought was that if I say; "every 1 minute please" and don't talk about seconds, it means exactly every 1 minute.
Only if I want to think about seconds, I want SstCron to tinker with seconds...

Any opinions? Is the implemented behaviour in line with Unix' cron?

Hi Joachim,

I know nothing about the SST implementation of cron, but the Unix specification is a comma separated list of numbers for each aspect or an asterisk.  e.g. every 10 minutes would use 0,10,20,30,40,50 for the minutes specification.  I have my doubts that "minutes: 1" really did what you thought it did, but that it coincidentally worked as you wished. I don't know what it would have done had you coded "minutes: 10".




Joachim

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: SstCronEntry setup

jtuchel
Well,

it turns out it didn't do what I wanted, because it ran the Block every single second of every minute.

What SstCron does it it converts the Integer into an interval from: 0 to: 59 by: @myInteger. So looking only at the minutes, SstCron does exactly what I tell it: run the Block every @myInteger minutes of the hour(s).

So I am not complaining about the part that I told SstCron about. It's more the part I said nothing about ;-)

If I understand correctly, Unix Cron won't run a job every second if you give an asterisk for the seconds.
On the other hand, I also didn't give SstCron an asterisk, I just didn't specify.

On the third hand, I didn't complain about SstCron running the job every minute of every hour, although I also hadn't specified anything abouot hours... Maybe this is just something you (or better: I ) need to be aware of and all is good...

Joachim





Am Donnerstag, 30. März 2017 21:52:02 UTC+2 schrieb Richard Sargent:
On Thursday, March 30, 2017 at 12:55:51 AM UTC-7, Joachim Tuchel wrote:
Dear VAST community,

I just was a little surprised by the behaviour or SstCron. It was just a matter of a couple of minutes to find the solution, but I wanted to share it here.

I wanted to set up a daemon that does some logging of system state (AbxProcessPeakDumper - thanks John for this Goodie!) every minute.

So I set up a Cron job like this:

SstCron default add: (
        SstCronEntry new
            workBlock: [KontolinoHeartbeat default beat];
            minutes: 1).


What surprised me is that this job runs every second.
In fact, you have to explicitly set the seconds. But it's not absolutely obvious that you cannot simply set seconds to zero.
You actually need to set the cron job up like this:

SstCron default add: (
        SstCronEntry new
            workBlock: [KontolinoHeartbeat default beat];
            minutes: 1;
seconds: #(0)
).

in order to have it run at exactly at second zero of every minute.

Maybe this is old hats to most of you, but I had to spend three minutes on this ;-) Not sure I want to suggest a change to it.
My first thought was that if I say; "every 1 minute please" and don't talk about seconds, it means exactly every 1 minute.
Only if I want to think about seconds, I want SstCron to tinker with seconds...

Any opinions? Is the implemented behaviour in line with Unix' cron?

Hi Joachim,

I know nothing about the SST implementation of cron, but the Unix specification is a comma separated list of numbers for each aspect or an asterisk.  e.g. every 10 minutes would use 0,10,20,30,40,50 for the minutes specification.  I have my doubts that "minutes: 1" really did what you thought it did, but that it coincidentally worked as you wished. I don't know what it would have done had you coded "minutes: 10".




Joachim

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.