Run action at certain time *only* once *and* system state

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

Run action at certain time *only* once *and* system state

Eric Montellese
Hello all,

I can check for a certain system state:

And I can run a check during a certain time period using the cron-style of service poll time:

And I can trigger a check to occur only once by checking the timestamp of a file:
(in the 'start' function, I touch a file -- then I can check the timestamp of the file to determine how long it has been since the program was run).

But I'm having a difficult time seeing how to put all of this into a single check. 

the overall goal is to:
1. run an update script once (and only once) per night
2. at a random point between certain hours (sometime between 1am-2am, for example)
3. but only if the system load is below a certain threshold

I can accomplish this with various workarounds or by doing some of these checks within the called script -- but it "feels like" something monit should be able to do cleanly and that I'm missing something.  Am I?

I see a related question in the archives here:
from 2015.

Thanks for any advice,
Eric