Bug 175823 - [patch] www/nginx - better handling of profiles
Summary: [patch] www/nginx - better handling of profiles
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Sergey A. Osokin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-04 11:50 UTC by Andrej Zverev
Modified: 2013-02-13 09:30 UTC (History)
0 users

See Also:


Attachments
nginx_coll.diff (833 bytes, patch)
2013-02-04 11:50 UTC, Andrej Zverev
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrej Zverev 2013-02-04 11:50:01 UTC
By default using profiles using rc.d/nginx will create .pid 
file in NGINX_RUNDIR (/var/run/) and names it as profile name + '.pid'.
This can make surpise for people who will name profile as syslog, exim, etc.

Following patch add prefix for pid file as "nginx_", so instead of
/var/run/syslog.pid nginx will create /var/run/nginx_syslog.pid.

People who are using nginx's profiles must be aware of these changes.
No bump portrevision since this not default behavior.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-02-04 11:50:13 UTC
Responsible Changed
From-To: freebsd-ports-bugs->osa

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Sergey A. Osokin freebsd_committer freebsd_triage 2013-02-13 06:20:09 UTC
Hi,

I'd like to commit following patch.

Index: nginx.in
===================================================================
--- nginx.in	(revision 312140)
+++ nginx.in	(working copy)
@@ -11,6 +11,9 @@
 #				Set it to "YES" to enable nginx
 # nginx_profiles (str):		Set to "" by default.
 #				Define your profiles here.
+# nginx_pid_prefix (str):	Set to "" by default.
+#				For multiple profiles set to "nginx_" for prevent
+#				to overwrite existing pid files.
 # nginxlimits_enable (bool):	Set to "NO" by default.
 #				Set it to yes to run `limits $limits_args`
 #				just before nginx starts.
@@ -47,7 +50,7 @@
 if [ -n "$2" ]; then
 	profile="$2"
 	if [ "x${nginx_profiles}" != "x" ]; then
-		pidfile="${_pidprefix}/${profile}.pid"
+		pidfile="${_pidprefix}/${nginx_pid_prefix}${profile}.pid"
 		eval nginx_configfile="\${nginx_${profile}_configfile:-}"
 		if [ "x${nginx_configfile}" = "x" ]; then
 			echo "You must define a configuration file (nginx_${profile}_configfile)"

Any objective?
Comment 3 dfilter service freebsd_committer freebsd_triage 2013-02-13 09:24:11 UTC
Author: osa
Date: Wed Feb 13 09:23:58 2013
New Revision: 312147
URL: http://svnweb.freebsd.org/changeset/ports/312147

Log:
  Add nginx_pid_prefix rcvar for ability to prevent collision with other PIDs names
  when using with profiles.
  
  Bump PORTREVISION.
  
  PR:	175823

Modified:
  head/www/nginx-devel/Makefile
  head/www/nginx-devel/files/nginx.in
  head/www/nginx/Makefile
  head/www/nginx/files/nginx.in

Modified: head/www/nginx-devel/Makefile
==============================================================================
--- head/www/nginx-devel/Makefile	Wed Feb 13 08:55:40 2013	(r312146)
+++ head/www/nginx-devel/Makefile	Wed Feb 13 09:23:58 2013	(r312147)
@@ -3,6 +3,7 @@
 
 PORTNAME=	nginx
 PORTVERSION=	1.3.12
+PORTREVISION=	1
 CATEGORIES=	www
 MASTER_SITES=	http://nginx.org/download/
 MASTER_SITES+=	${MASTER_SITE_LOCAL}

Modified: head/www/nginx-devel/files/nginx.in
==============================================================================
--- head/www/nginx-devel/files/nginx.in	Wed Feb 13 08:55:40 2013	(r312146)
+++ head/www/nginx-devel/files/nginx.in	Wed Feb 13 09:23:58 2013	(r312147)
@@ -11,6 +11,9 @@
 #				Set it to "YES" to enable nginx
 # nginx_profiles (str):		Set to "" by default.
 #				Define your profiles here.
+# nginx_pid_prefix (str):	Set to "" by default.
+#				When using profiles manually assign value to "nginx_"
+#				for prevent collision with other PIDs names.
 # nginxlimits_enable (bool):	Set to "NO" by default.
 #				Set it to yes to run `limits $limits_args`
 #				just before nginx starts.
@@ -47,7 +50,7 @@ load_rc_config $name
 if [ -n "$2" ]; then
 	profile="$2"
 	if [ "x${nginx_profiles}" != "x" ]; then
-		pidfile="${_pidprefix}/${profile}.pid"
+		pidfile="${_pidprefix}/${nginx_pid_prefix}${profile}.pid"
 		eval nginx_configfile="\${nginx_${profile}_configfile:-}"
 		if [ "x${nginx_configfile}" = "x" ]; then
 			echo "You must define a configuration file (nginx_${profile}_configfile)"

Modified: head/www/nginx/Makefile
==============================================================================
--- head/www/nginx/Makefile	Wed Feb 13 08:55:40 2013	(r312146)
+++ head/www/nginx/Makefile	Wed Feb 13 09:23:58 2013	(r312147)
@@ -3,6 +3,7 @@
 
 PORTNAME=	nginx
 PORTVERSION=	1.2.7
+PORTREVISION=	1
 PORTEPOCH=	1
 CATEGORIES=	www
 MASTER_SITES=	http://nginx.org/download/

Modified: head/www/nginx/files/nginx.in
==============================================================================
--- head/www/nginx/files/nginx.in	Wed Feb 13 08:55:40 2013	(r312146)
+++ head/www/nginx/files/nginx.in	Wed Feb 13 09:23:58 2013	(r312147)
@@ -11,6 +11,9 @@
 #				Set it to "YES" to enable nginx
 # nginx_profiles (str):		Set to "" by default.
 #				Define your profiles here.
+# nginx_pid_prefix (str):	Set to "" by default.
+#				When using profiles manually assign value to "nginx_"
+#				for prevent collision with other PIDs names.
 # nginxlimits_enable (bool):	Set to "NO" by default.
 #				Set it to yes to run `limits $limits_args`
 #				just before nginx starts.
@@ -47,7 +50,7 @@ load_rc_config $name
 if [ -n "$2" ]; then
 	profile="$2"
 	if [ "x${nginx_profiles}" != "x" ]; then
-		pidfile="${_pidprefix}/${profile}.pid"
+		pidfile="${_pidprefix}/${nginx_pid_prefix}${profile}.pid"
 		eval nginx_configfile="\${nginx_${profile}_configfile:-}"
 		if [ "x${nginx_configfile}" = "x" ]; then
 			echo "You must define a configuration file (nginx_${profile}_configfile)"
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 4 Sergey A. Osokin freebsd_committer freebsd_triage 2013-02-13 09:25:30 UTC
State Changed
From-To: open->closed

I've committed different changes, thanks for report!