Skip to content
This repository has been archived by the owner. It is now read-only.

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 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 issue 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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants