Skip to content
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

Nginx init.d script not filtering out comments correctly when awk-ing for the PID #35

Merged
merged 1 commit into from Apr 27, 2013

Conversation

@tjasko
Copy link
Contributor

tjasko commented Apr 27, 2013

When you declare the PID file in /etc/nginx/nginx.conf file like this:

# set the pid file of Nginx
pid /var/run/nginx.pid;

The code (PID=$(awk -F'[ ;]' '/[^#]pid/ {print $2}' /etc/nginx/nginx.conf)) getting the PID will include the comment (even though it excludes all other comments) making $PID output as follows:

set
/var/run/nginx.pid

I changed the variable to be set with awk -F'[ ;]' '$1 !~ /^#/ && /pid/ {print $2}' /etc/nginx/nginx.conf and now it is working correctly when someone includes "pid" in any comment above.

gplessis pushed a commit that referenced this pull request Apr 27, 2013
Nginx init.d script not filtering out comments correctly when awk-ing for the PID

(Thanks @tjasko)
@gplessis gplessis merged commit b80dbfc into gplessis:master Apr 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.