How to restart a systemctl service from within the process

Colin Law clanlaw at gmail.com
Mon Nov 23 13:37:24 UTC 2020


On Mon, 23 Nov 2020 at 13:15, Chris Green <cl at isbd.net> wrote:
> ...
> It's all a bit of a can of worms, adding --user to the line I sent you
> simply returns an error:-
>
>     Failed to restart syncthing at chris.service: Unit syncthing at chris.service not found
>
> However I'm sure what you want to do *can* be done.  This thread on
> StackExchange is illuminating:-
>
>     https://unix.stackexchange.com/questions/496982/restarting-systemd-service-only-as-a-specific-user#497011
>
> Scroll down to "A third option" in the answers.

Yes, that would work, but again not with the standard node-red
install, which provides the service file.  So I think I am stuck with
the sudo-without-password route which does involve the user doing a
small amount of configuring of the system, but it is minimal, and
won't be messed up by an upgrade to node-red which overwrites the
service file.  For the record the sudo route is achieved by running
sudo visudo and adding

theuser ALL= NOPASSWD: /bin/systemctl restart nodered.service

Thanks all for the help

Colin

>
> --
> Chris Green
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users




More information about the ubuntu-users mailing list