How to restart a systemctl service from within the process
Karl Auer
kauer at biplane.com.au
Sun Nov 22 14:18:31 UTC 2020
On Sun, 2020-11-22 at 13:55 +0000, Colin Law wrote:
> I can't kill it forcibly, as that would close down node-red without
> properly closing everything down, writing caches out etc.
If you use TERM, that will allow it to close down gracefully.
> If I do a
> clean termination then the restart on failure won't restart it.
The Restart option has various possibilities - including "always", so
you it restarts even if it exited cleanly.
> The problem is that I would have to instruct anyone
> importing my code to do that, which is just not appropriate. They
> likely wouldn't have the expertise to do it.
I think you've painted yourself into the corner of having to use a bad
method just because it is a method that requires no end-user action. If
you can't make any substantive changes then yep, you are stuck with
using systemctl.
> What is bodged up about calling systemctl restart? That is the
> recommended way of restarting a service.
You have constraints that mean you have to do it that way, so *shrug*.
> You don't need to answer that, I just would like an answer to the
> original question.
I think you know more about that now that anyone except the systemd
developers. I'm sure there is a forum somewhere where they hang out,
maybe ask them?
Regards, K.
PS: If you have any kind of install script for this thing you could
preserve the original service file. Provide an uninstall option that
puts it back.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
GPG fingerprint: 2561 E9EC D868 E73C 8AF1 49CF EE50 4B1D CCA1 5170
Old fingerprint: 8D08 9CAA 649A AFEF E862 062A 2E97 42D4 A2A0 616D
More information about the ubuntu-users
mailing list