-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Post Install Script Issues #739
Conversation
scripts/packages/postinstall.sh
Outdated
@@ -39,7 +40,18 @@ detect_nginx_users() { | |||
|
|||
if [ -z "${nginx_user}" ]; then | |||
printf "PostInstall: Reading NGINX process information to determine NGINX user\n" | |||
nginx_user=$(ps aux | grep "nginx: master process" | grep -v grep | head -1 | awk '{print $1}') | |||
nginx_pid="" | |||
for pid in $(ls /proc | grep -E '^[0-9]+$'); do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to install the Shellcheck extension for VS Code: https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck
My Shellcheck is complaining about this ls
command, here's the error it refers to: https://www.shellcheck.net/wiki/SC2010
@spencerugbo Looks like you need to merge the main into your branch. |
…when detecting users
…when detecting users
1538290
to
e5bd519
Compare
scripts/packages/postinstall.sh
Outdated
@@ -141,7 +168,7 @@ create_run_dir() { | |||
|
|||
update_unit_file() { | |||
# Fill in data to unit file that's acquired post install | |||
if command -V systemctl >/dev/null 2>&1; then | |||
if command -v systemctl && [ "$(cat /proc/1/comm)" == "systemd" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should keep the uppercase -V
.
scripts/packages/postinstall.sh
Outdated
@@ -20,7 +21,7 @@ WORKER_USER="" | |||
AGENT_GROUP="nginx-agent" | |||
|
|||
detect_nginx_users() { | |||
if command -V systemctl >/dev/null 2>&1; then | |||
if command -v systemctl && [ "$(cat /proc/1/comm)" == "systemd" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should keep the uppercase -V.
if command -v systemctl && [ "$(cat /proc/1/comm)" == "systemd" ]; then | |
if command -V systemctl && [ "$(cat /proc/1/comm)" == "systemd" ]; then |
Unless there was a reason for the change?
Proposed changes
This PR aims to prevent silent fails when agent is installed in a Debian docker image. PostInstall.sh no longer uses the ps command to detect nginx users.
Checklist
Before creating a PR, run through this checklist and mark each as complete.
CONTRIBUTING
documentmake install-tools
and have attached any dependency changes to this pull requestREADME.md
)