Skip to content

fix: guard nginx reload when sudo is unavailable#3

Open
shanzez wants to merge 1 commit into
Platform-Collective:mainfrom
shanzez:fix/nginx-reload-sudo-guard
Open

fix: guard nginx reload when sudo is unavailable#3
shanzez wants to merge 1 commit into
Platform-Collective:mainfrom
shanzez:fix/nginx-reload-sudo-guard

Conversation

@shanzez

@shanzez shanzez commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

nginx.sh unconditionally runs sudo nginx -s reload. On hosts where the script already runs as root and sudo is not installed (common in minimal or container environments), that fails with sudo: command not found.

This change:

  • runs nginx -s reload directly when already root (no sudo needed),
  • falls back to sudo nginx -s reload when sudo is available,
  • otherwise prints a clear hint instead of erroring out.

Focused one-block change in the existing style; shellcheck-clean on the changed lines. Fixes the case reported upstream in huly-selfhost#277.

Contributed by Exaviz (exaviz.com).

nginx.sh always called `sudo nginx -s reload`, which fails on hosts
where the script already runs as root and `sudo` is not installed
(common in minimal/root container environments).

Run `nginx -s reload` directly when already root, fall back to `sudo`
when available, and otherwise print a clear hint instead of failing.

Fixes the case reported upstream in huly-selfhost#277.

Signed-off-by: Exaviz <info@exaviz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant