mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-19 23:31:50 +02:00
Fix service supervision and local variable scoping in ha_entrypoint.sh
Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com>
This commit is contained in:
@@ -199,8 +199,15 @@ if $PID1; then
|
|||||||
echo "Starting: $runfile"
|
echo "Starting: $runfile"
|
||||||
sed -i "1s|^.*|#!$shebang|" "$runfile"
|
sed -i "1s|^.*|#!$shebang|" "$runfile"
|
||||||
chmod +x "$runfile"
|
chmod +x "$runfile"
|
||||||
(exec "$runfile") &
|
(
|
||||||
true
|
restart_count=0
|
||||||
|
while true; do
|
||||||
|
"$runfile" || true
|
||||||
|
restart_count=$((restart_count + 1))
|
||||||
|
echo -e "\e[38;5;214m$(date) WARNING: $runfile exited, restarting (#${restart_count}) in 5s...\e[0m"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
) &
|
||||||
done
|
done
|
||||||
shopt -u nullglob
|
shopt -u nullglob
|
||||||
fi
|
fi
|
||||||
@@ -214,6 +221,7 @@ if $PID1; then
|
|||||||
echo -e "\033[0;32mEverything started!\033[0m"
|
echo -e "\033[0;32mEverything started!\033[0m"
|
||||||
|
|
||||||
terminate() {
|
terminate() {
|
||||||
|
local local_pid
|
||||||
echo "Termination signal received, forwarding to subprocesses..."
|
echo "Termination signal received, forwarding to subprocesses..."
|
||||||
if command -v pgrep >/dev/null 2>&1; then
|
if command -v pgrep >/dev/null 2>&1; then
|
||||||
while read -r pid; do
|
while read -r pid; do
|
||||||
|
|||||||
Reference in New Issue
Block a user