How to restart a systemctl service from within the process

Colin Law clanlaw at gmail.com
Sun Nov 22 09:45:50 UTC 2020


I have a service (a nodejs process running node-red) and want it to
self-restart.  The obvious way appears to be to invoke
systemctl restart theservice
but I am concerned about the fact that the process running the
systemctl command will itself be killed as part of the restart.  It
does seem to work but that is not a guarantee that there is not a
possible race condition that could cause it to fail.  I am hoping that
someone can reassure me that there is not actually a problem doing
this.

Colin




More information about the ubuntu-users mailing list