Home assistant upgrade with stop and restart service

Good morning DietPi user,

I like to integrate in the DietPi standard script (homeassistant-update.sh)
that I already use, and that works perfectly, also the possibility to stop the service
and restart it again at the end of the update.

I tried to integrate the command:
dietpi-services stop/start home-assistant
but i can’t get it to work properly…

Do you have any advice or solution

Thanks in advance for all help !

You are creating a script? If yes, you need to call other function with the full path to the respective executable. Using an alias will not work. Stopping HA should work like this

/usr/bin/systemctl stop home-assistant

I found ‘systemctl’ under /bin folder and the script

#!/bin/dash
sudo /bin/systemctl stop home-assistant
sudo /home/homeassistant/homeassistant-update.sh
sudo /bin/systemctl start home-assistant

seems work correctly !

Thanks for your help !!!

systemctl does not need to be given with full path in script, since it is an executable located in the default PATH location /usr/bin. But dietpi-services, which you tried originally, needs to be, since it is an alias for an executable located in a non-default location /boot/dietpi/dietpi-services. However, this is more a frontend and error-handling tool for controlling services. For your script, use systemctl (without path).

@Michalng,
I’ll try without path, anyway that’s how it works fine.

Thank you.