From db61a623d5d351e165239d5e9bd90f48c0cad9fe Mon Sep 17 00:00:00 2001 From: Jorge Schrauwen Date: Mon, 2 Aug 2021 09:38:08 +0200 Subject: [PATCH] Allow non systemctl systems to use update.sh (#8206) With this change update.sh works on systems that do not use systemctl. I can update z2m on my illumos machine by running `svcadm disable zigbee2mqtt; ./update.sh ; svcadm enable zigbee2mqtt` --- update.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/update.sh b/update.sh index 8ab2d47cc..1cd10ee6a 100755 --- a/update.sh +++ b/update.sh @@ -7,8 +7,12 @@ if [ -d data-backup ]; then exit 1 fi -echo "Stopping Zigbee2MQTT..." -sudo systemctl stop zigbee2mqtt +if which systemctl 2> /dev/null > /dev/null; then + echo "Stopping Zigbee2MQTT..." + sudo systemctl stop zigbee2mqtt +else + echo "Skipped stopping Zigbee2MQTT, no systemctl found" +fi echo "Creating backup of configuration..." cp -R data data-backup @@ -24,7 +28,11 @@ echo "Restore configuration..." cp -R data-backup/* data rm -rf data-backup -echo "Starting Zigbee2MQTT..." -sudo systemctl start zigbee2mqtt +if which systemctl 2> /dev/null > /dev/null; then + echo "Starting Zigbee2MQTT..." + sudo systemctl start zigbee2mqtt +else + echo "Skipped starting Zigbee2MQTT, no systemctl found" +fi echo "Done!"