No -p (PID file) option when run with systemd?

I want to use -p and create a PID file so monit can watch the daemon and restart it when it’s not responding (ea when I have thread starvation or an other bug in my apps).

But it looks like the -p argument is not working if you don’t use -d

Am I right? Should I file a bug report?

I’m not an AppDaemon user, but I know systemd has the PIDFile option for service units. Maybe this resolves your issue of having to use that as a parameter for the command itself.
Besides that, systemd can be configured to automatically restart a service if it crashes. The Restart option would be what you need in this case.

You can use Monit to monitor daemon processes or similar programs running on localhost. Monit is particularly useful for monitoring daemon processes,

you use -d to start appdaemon as daemon.
without -d appdaemon isnt a deamon. so thats no bug but intention.

When you start appdaemon with systemd you do not and should not use -d option (see documentation) and it still runs as a daemon then. The -d option is for a “stand-alone” daemon mode.

in the docs it says -p and -d are connected.
so maybe that @aimc can tell you how to use that from a service.

That was my point to start with. IMHO the -p argument should not be coupled to the -d. Home Assistant has both a -d and -p option and the work separate. My systemd and monit setup works fine for home assistant, just not for appdaemon.

but at least we can say for sure that it is not a bug, but something by design.
maybe it is possible and the docs need an addition, maybe it isnt possible by choice or because that option is missed.

but only Andrew can give that answer.

Thank you for all your wisdom Rene.

ill ask andrew if he can find time to look at your problem next month if he can find the time.

I’m deprecvating -d in 4.0 anyway in favor of systemd use. I’ll look into adding this functionality in that timeframe as well.

1 Like