I have a service that I would like to manage through systemd - let's call it foo
. I wrote unit files, and they're working just fine. So, if I run systemctl start foo
, the service starts correctly, and I can see its status with systemctl status foo
.
However, an external program may also start the service, and it doesn't use systemd to start the service. So, the service can be running, but since it wasn't started through systemd, systemd doesn't know about it. In this case, systemctl status foo
reports that the service has failed, even though its running correctly.
Is there a way to have systemd 'inherit' or 'adopt' this service, so systemctl status foo
correctly reports that the service is running, even when systemd didn't start it? With SysV, I would write a small 'status' script, so I could /etc/init.d/foo status
, but that doesn't seem to fit with the systemd model.
To be clear, when the external program starts the service, the service's processes are still children of PID 1/systemd. But, systemd doesn't recognize them as part of service foo
, since systemd didn't start and register them.
The specific technologies are:
- Oracle WebLogic (the service is a Managed WebLogic Instance)
- Oracle NodeManager (this is the external program that may also start the service)
- systemd 219
Type=dbus
) should be perfectly fine, and doesn't suffer from the problems you describe. Given upstart is mostly gone at this point, I think it's important to point out or clarify the context of those problems with D-Bus activation. They were more relevant in the past, before Debian/Ubuntu switched to systemd by default. – filbranden Nov 13 '18 at 19:33service
because it's not what you want with the old sysvinits ? you don't want a sysvinit service for a dbus-activatable service, because runningservice
can return failure if it races with someone else, right? I guess the ol'service
API wants tightening up a bit first? – sourcejedi Nov 13 '18 at 21:31