how to run a script ONLY ONCE at start of indigo

Posted on
Thu Apr 26, 2018 10:46 am
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: how to run a script ONLY ONCE at start of indigo

Ignore me. OP says startup which somehow became shutdown in my head.

Never mind.


Sent from my iPhone using Tapatalk

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Thu Apr 26, 2018 1:36 pm
Hackencrash offline
User avatar
Posts: 246
Joined: Dec 16, 2015
Location: UK

Re: how to run a script ONLY ONCE at start of indigo

Yes please Karl, I’d love a copy of an Indigo shutdown plugin to trigger a voice announce and email as I’ve been caught out a couple of times where MacOS has updated and not restarted cleanly. No need to productionize it - I’ll take it as is.

I had a rubbish heating script which left the house absolutely boiling hot after failing to run after an OS update - oops!


Sent from my iPhone using Tapatalk

Posted on
Thu Apr 26, 2018 1:54 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: how to run a script ONLY ONCE at start of indigo

I HIGHLY recommend turning off auto updates for just this reason. That way you can update when you can focus your full attention on the whole process (including dealing with issues).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Apr 26, 2018 2:49 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: how to run a script ONLY ONCE at start of indigo

It’s on my GitHub/kw123


Sent from my iPhone using Tapatalk

Posted on
Thu Apr 26, 2018 11:32 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: how to run a script ONLY ONCE at start of indigo

I know the shutdown plugin is a work around.. and yes it will fire if its reloaded .. that why there is the enable variable test included.. But a regular indigo event would be really nice and ?easy to do?..

.. is there a log file entry when indigo shuts down? we could use that one for an "and" trigger

Karl

Posted on
Fri Apr 27, 2018 10:14 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: how to run a script ONLY ONCE at start of indigo

kw123 wrote:
But a regular indigo event would be really nice and ?easy to do?..


Not necessarily easy. The problem is how long should the server wait on actions fired from a shutdown trigger until it kills them? If, for instance, the action on the shutdown trigger fired an external script (which could run forever), how long should it wait until it kills the script and continues the shutdown? What if it gets the shutdown notification from the OS rather than from the client? Perhaps the shutdown came from a UPS where the battery is about to go out so you'd want the server to shut down quickly (but we don't know the circumstances for the shutdown request).

So, technically, it would be pretty simple to generate the event itself. But the problem is what happens after the server fires the actions for the event(s). I'm sure there are other reasons why doing a shutdown trigger is tricky. And, honestly, demand has been quite low anyway so it's an easy one to kick down the road.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Apr 27, 2018 12:39 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: how to run a script ONLY ONCE at start of indigo

I understand the issues.. but still need one .

So I will stick with the little plugin and will add a logfile scan (tail -1000) scanning for indigo shutdown ..

Karl

Posted on
Fri Apr 27, 2018 5:28 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: how to run a script ONLY ONCE at start of indigo

Tuned the plugin a little:
now checks if "Quitting Indigo Server - stopping plugins" is in the last 400 lines of the indigo logfile and is not followed by "Loading plugin"
Only then AND if the variable "shutdownActionEnabled" is set to 1, true, or yes the shutdown action is performed.

Karl

github.com/kw123

Who is online

Users browsing this forum: No registered users and 2 guests