Exec Node - How to

I would apreciate the support how to run this sett of linux/raspbian commands. ( using exec node?) if so how?

# Stop Zigbee2MQTT and go to directory
sudo systemctl stop zigbee2mqtt
cd /opt/zigbee2mqtt

# Backup configuration
cp -R data data-backup

# Update
git checkout HEAD -- npm-shrinkwrap.json
git fetch
git checkout dev # Change 'dev' to 'master' to switch back to the release version
git pull
npm ci

# Restore configuration
cp -R data-backup/* data
rm -rf data-backup

# Start Zigbee2MQTT
sudo systemctl start zigbee2mqtt
  1. Add the commands to a shell script
  2. Call the shell script from the exec node

Thank you, I woll investigate this shell script

In addition you will have to allow the user that is running node red to perform those sudo commands without having to provide a password (as you cannot provide a password via the exec node). You can do that using sudo visudo.

1 Like

Thank you

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.