Auto-start the web admin on every container start

The web admin script (/usr/local/bin/easy-asterisk-webadmin) is
generated on demand by the interactive CLI, but only ever lived in
the container's writable layer — not baked into the image, not
bind-mounted. Every docker compose down/up wiped it, and the
entrypoint's start logic only ran "if the file already exists", so
it silently never started again until someone manually ran the CLI's
Web Admin menu once per recreate.

Added a --write-web-admin-script non-interactive entry point
(same pattern as --rebuild-dialplan) and call it unconditionally
before the existence check, so the web admin comes back on its own
every time the container starts.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015X1jRGHwrvovz2qkhKfDZi
This commit is contained in:
Claude
2026-07-20 18:13:39 +00:00
parent 24827a326f
commit 52db0fa921
2 changed files with 21 additions and 2 deletions
+12
View File
@@ -7024,4 +7024,16 @@ if [[ "${1:-}" == "--rebuild-dialplan" ]]; then
exit 0
fi
# Non-interactive entry point used by the container entrypoint on every
# start. create_web_admin_script() writes /usr/local/bin/easy-asterisk-
# webadmin, but that file lives only in the container's writable layer —
# it isn't baked into the image or bind-mounted anywhere — so it's wiped
# on every recreate. Without regenerating it here, the web admin only
# ever starts after someone manually runs it once from the interactive
# CLI menu, which defeats the point of it auto-starting at all.
if [[ "${1:-}" == "--write-web-admin-script" ]]; then
create_web_admin_script
exit 0
fi
main "$@"