I’m trying to automate a few things, including updates inside one of my containers. I figured it would be a good idea to use the output of a command as variable and if that variable contains a certain value, restart the container.
I created the following test:
update_nodejs=$( sudo docker exec homebridge hb-service update-node --allow-root )
if [[ $update_nodejs != *"already up-to-date"* ]]
then
sudo docker restart homebridge
fi
My problem: where this works for commands like “git pull”, in this case the variable is/stays empty. I have also tried appending the output to a file, with the same result.
I’m running Docker on Synology, don’t know if that helps solving this issue?