Hello @jbudd , @Colin and @DiverRich ,
Thanks for helping me out. yes it’s a revpi-nodered not the std. node-red.
Finally managed to execute a node-red restart and sudo reboot by
- Editing the ‘sudo nano /lib/systemd/system/nodered.service‘
# systemd sandboxing process
ProtectSystem=strict
ProtectControlGroups=yes
ProtectKernelModules=no
ProtectKernelTunables=no
- Then created the override file with the below settings.
### Editing /etc/systemd/system/nodered.service.d/override.conf
### Anything between here and the comment below will become the new contents of the file
[Service]
NoNewPrivileges=no
ProtectSystem=on
PrivateTmp=yes
- finally Added the service for node-red restart and reboot in sudo visudo
nodered ALL=NOPASSWD: /bin/systemctl restart nodered.service, /sbin/reboot
nodered ALL=(ALL) NOPASSWD: /usr/bin/node-red-restart
Defaults:nodered !requiretty
- From my node-red exec node , using sudo /sbin/reboot and sudo /bin/systemctl restart nodered.service (refer the below picture)
I’m not certain if this is the most appropriate way to implement the functionality while ensuring security and avoiding potential vulnerabilities.
Kindly advise if anything can be improved with this approach.
@Colin : Thanks for the link (Documentation=https://gitlab.com/revolutionpi/noderedrevpinodes-server) , i will check this out.
Best Regards,
Mani