On Jan 17, 2017, at 5:08 AM, Glyph Lefkowitz wrote:
It depends if it's easier to keep track of when changes happen, or determine what the current state is.
If it's easier to keep track of when changes happen, I would recommend calling `setServiceParent` to add/remove the service to the active service hierarchy. (This will call `startService` / `stopService` for you automatically, as well as cooperating with things like ^c so it's better than calling them yourself).
If it's easier to query the current state, then a conditional in the timer is a lot simpler.
Thanks for the quick reply. Can you point to some docs about setServiceParent being used to remove the service? I couldn't find that anywhere. I'm leaning towards that approach, because it would just consolidate where I write conditional (one place vs 9 services). I had intended to run nagios, but got lazy and just installed monit, which was took under 3 minutes to install and configure to invoke an alert and touch/remove a marker on the filesystem to indicate state.