Help needed with executing bash file at PI or HASS startup

With HA bridge being upgraded to 3.2.0 also some stuff changed with the startup. This following the instructions here. There is now a .sh file in the habridge dir called “starthabridge.sh”

If I start this with putty sudo ./starthabridge.sh all is fine. HA bridge starts and works.

I would love to have this start at PI startup or alternatively as HASS starts. I have tried this solution but no go (or Im doing something wrong).

Anyone some advice pls?

For completeness the content of the .sh

#!/bin/bash
cd /home/pi/habridge
rm /home/pi/habridge/habridge-log.txt
nohup java -jar /home/pi/habridge/ha-bridge-3.2.0.jar > /home/pi/habridge/habridge-log.txt 2>&1 &
chmod 777 /home/pi/habridge/habridge-log.txt

This is what should do it but no go:

cd /etc/init.d
sudo chmod u+x starthabridge.sh
update-rc.d starthabridge.sh defaults

I went through this yesterday when I updated. I used the instructions @jbardi provideed here in step no 5. And followed the link from the github Ha-Bridge repo.

It took me a very long time to realise I’d messed up a directory when I copied the instructions from github.

This line

ExecStart=/usr/bin/java -jar -Dconfig.file=/home/pi/amazon-echo/data/habridge.config /home/pi/amazon-echo/ha-bridge-3.2.0.jar

Should be

ExecStart=/usr/bin/java -jar -Dconfig.file=/home/pi/habridge/data/habridge.config /home/pi/habridge/ha-bridge-3.2.0.jar

The git hub links here for further info.

Second problem was it now defaults to port 80, which caused a conflict, the github has instructions for changing this back to 8080 as it was before.

Well spotted!! After I changed that all was fine and HA bridge restarts when rebooted.