ports/124940: [patch] add multiple profiles support to www/nginx rc.d script
Eygene Ryabinkin
rea-fbsd at codelabs.ru
Tue Jun 24 14:50:02 UTC 2008
>Number: 124940
>Category: ports
>Synopsis: [patch] add multiple profiles support to www/nginx rc.d script
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Tue Jun 24 14:50:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: Eygene Ryabinkin
>Release: FreeBSD 7.0-STABLE i386
>Organization:
Code Labs
>Environment:
System: FreeBSD XXX 7.0-STABLE FreeBSD 7.0-STABLE #16: Tue Mar 18 11:49:55 MSK 2008 root at XXX:/usr/obj/usr/src/sys/XXX i386
>Description:
Recently I needed to run two nginx instances with different users.
In FreeBSD's Apache port this can be accomplished with multiple
profiles, but stock rc.d script for nginx lacks this functionality.
I had added it along the lines of Apache rc.d script.
>How-To-Repeat:
Look at the rc.d/nginx: it is not possible to run more that one
server with different configuration files.
>Fix:
The following patch adds the needed functionality.
--- nginx.sh-multiple-profiles.patch begins here ---
--- files/nginx.sh.in 2008-06-24 18:33:45.000000000 +0400
+++ files/nginx.sh.in.new 2008-06-24 18:33:48.000000000 +0400
@@ -25,6 +25,33 @@
load_rc_config $name
+# Handle profiles here
+if [ -n "$2" ]; then
+ if [ -n "${nginx_profiles}" ]; then
+ eval nginx_configfile=\"\${nginx_${2}_configfile:-}\"
+ if [ -z "$nginx_configfile" ]; then
+ echo "nginx_${2}_configfile is not set"
+ exit 1
+ fi
+ required_files="${nginx_configfile}"
+ eval nginx_enable=\"\${nginx_${2}_enable:-${nginx_enable}}\"
+ eval nginx_flags=\"\${nginx_${2}_flags:-${nginx_flags}}\"
+ eval nginx_pidfile=\"\${nginx_${2}_pidfile:-/var/run/nginx.${2}.pid}\"
+ nginx_flags="${nginx_flags:-} -c ${nginx_configfile}"
+ else
+ echo "$0: no nginx profiles, argument '$2' ignored."
+ fi
+else
+ # Loop over profiles, spawning ourself.
+ if [ -n "$nginx_profiles" -a -n "$1" ]; then
+ for p in ${nginx_profiles}; do
+ echo "===> nginx profile: ${p}"
+ %%PREFIX%%/etc/rc.d/nginx%%RC_SUBR_SUFFIX%% "$1" "$p"
+ done
+ exit 0
+ fi
+fi
+
pidfile="${nginx_pidfile}"
extra_commands="configtest reload"
--- Makefile.orig 2008-06-24 18:39:12.000000000 +0400
+++ Makefile 2008-06-24 18:39:58.000000000 +0400
@@ -44,6 +44,8 @@
CONFLICTS?= nginx-devel-0.*
USE_RC_SUBR= nginx.sh
+SUB_LIST+= RC_SUBR_SUFFIX=${RC_SUBR_SUFFIX}
+
HAS_CONFIGURE= yes
CONFIGURE_ARGS+=--prefix=${ETCDIR} \
--with-cc-opt="-I ${LOCALBASE}/include" \
--- nginx.sh-multiple-profiles.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list