Last active
December 8, 2023 15:11
-
-
Save mbierman/1d0fceaea979f17ca65f1599fb1ebbbb to your computer and use it in GitHub Desktop.
start homebridge on Fireawlla
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Save this to ~/.firewalla/config/post_main.d inorder to make sure homebridge restarts automatically every time Firewalla does. That directory may not exist so just create it if that's the case. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
log=/data/fw_reboot.txt | |
sudo systemctl start docker | |
running_check () { | |
i=1 | |
for i in {1..10} | |
do | |
echo "iter: $i" | |
up=$(sudo docker ps | grep -o oznu/homebridge:latest) | |
echo up is: $up | |
if [ "$up" = "oznu/homebridge:latest" ] ; then | |
echo "$(date) homebridge is already running. Exiting" | tee -a $log | |
exit | |
fi | |
echo "Waiting for homebridge to start..." | |
sleep 10 | |
if [ "$i" -eq "10" ]; then | |
echo "Starting docker compose..." | |
sudo systemctl start docker-compose@homebridge && sudo docker image prune && running_check | |
fi | |
done | |
} | |
running_check |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment