How would someone go about implementing some code that gets executed when the program stops/ends? So similarly to the installation node’s generateScript() but at the end of the program.
there are various ways to accomplice something like this.
One would be to monitor when the program changes state between running and stopping using the dashbord interface’s, programState command.
A simpler but bit hackier solution would be to set a run state on a configurable digital output first time the script is called, and then monitor the value of this output using a thread in the installation nodes contribution file.
if it needs to be script calls simply use one of the methods above but combine them with the primary- or secondary interface.
Thanks cg1, I ended up using the built-in advanced program node Script, and setting it as the last step step in the program. In that node, I call a daemon shutdown method via xml-rpc