mirror of
https://github.com/home-assistant/operating-system.git
synced 2026-04-29 21:21:54 +01:00
* Avoid CLI restart on shutdown * Update buildroot-external/rootfs-overlay/usr/sbin/hassos-cli
38 lines
938 B
Bash
Executable File
38 lines
938 B
Bash
Executable File
#!/bin/sh
|
|
# ==============================================================================
|
|
# Run logging cli
|
|
# ==============================================================================
|
|
|
|
echo "Waiting for the Home Assistant CLI to be ready..."
|
|
|
|
i=0
|
|
while [ ! "$(docker ps -q -f name=hassio_cli)" ]; do
|
|
sleep 1
|
|
i=$((i+1))
|
|
if [ $i = 60 ]; then
|
|
echo "[WARN] Home Assistant CLI not starting! Jump into emergency console..."
|
|
exec /bin/ash -l
|
|
fi
|
|
done
|
|
|
|
docker container exec \
|
|
-ti hassio_cli \
|
|
/usr/bin/cli.sh
|
|
|
|
case $? in
|
|
10)
|
|
# Jump to root login shell (login command)
|
|
exec /bin/ash -l
|
|
;;
|
|
143)
|
|
# 143 graceful termination (SIGTERM). Most likely a proper shutdown.
|
|
# Just sleep for a while until actual systemd shutdown gets invoked.
|
|
echo ""
|
|
echo "Home Assistant CLI has been terminated."
|
|
sleep 30
|
|
;;
|
|
*)
|
|
echo "HA CLI failed with error code: $?"
|
|
;;
|
|
esac
|