Hi Team, is there any option in KM to do similar to this Win scheduler?
Example: I need to execute basic shell script with 1h delay. That is no pr, but if during that time mac power go off, can Task be finished after restart? Pls suggest. Thx
Hi Team, is there any option in KM to do similar to this Win scheduler?
Example: I need to execute basic shell script with 1h delay. That is no pr, but if during that time mac power go off, can Task be finished after restart? Pls suggest. Thx
Sure, this is relatively straight forward. I presume currently you do something like:
Firstly, that's generally not a great idea since Keyboard Maestro Engine is spinning its wheels for 1 hour, which is wasteful. But it's ok, except that as you note, if Keyboard Maestro Engine is quit for any reason then the cleanup task does not run.
So instead, what you do is enable a macro that triggers every minute and determines whether it is time to run or not, and once it runs it disables itself.
So something like this:
DND_CleanUpTask
to 0
or NOW()
The next question is, what exact behaviour do you want. Do you want the clean up task to run at least 1 hour later, or do you want the Mac to be running for at least 1 hour before the clean up task runs. In other words, if after half an hour you shut the Mac down for an hour, do you want the clean up task to run more or less immediately on login, or do you want it to wait another half hour?
If the former, set DND_CleanUpTask to now()
and then have the Clean Up macro:
Trigger every minute
Action:
Otherwise, if you want at least an hour of running time before the cleanup, set DND_CleanUpTask to 0
and do this:
Trigger every minute
Action:
DND_CleanUpTask + 1
LOL. Could only be said by someone who already knows exactly what to do.
Following your logic takes some study to implement properly.
Just sayin' for those who don't find it "relatively straight forward."
Exactly. I didn't say it was obvious, only relatively straight forward. It uses a fairly simple technique, that has wide applications, but is probably not something people would think to do without learning about the technique first. But that is true of lots of things. Baking a packet cake is relatively straight forward, but if you try to do it without the instructions, it better not be your first time.
There is nothing complex in the technique I've described, and it is generally applicable: enable a macro that triggers periodically, and in that macro determine when to operate, and then disable itself after operating.
In this instance, it's literally four or five simple actions, and fairly simple logic, which is what I mean by relatively straight forward (which means literally “uncomplicated or easy to understand”, which I think this is), but not necessarily “obvious” (easily perceived, self-evident).