Skip to content

Instantly share code, notes, and snippets.

@mbierman
Last active December 8, 2023 15:11
Show Gist options
  • Save mbierman/1d0fceaea979f17ca65f1599fb1ebbbb to your computer and use it in GitHub Desktop.
Save mbierman/1d0fceaea979f17ca65f1599fb1ebbbb to your computer and use it in GitHub Desktop.
start homebridge on Fireawlla
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.
#!/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