diff options
author | danger <danger@FreeBSD.org> | 2011-07-26 00:15:50 +0800 |
---|---|---|
committer | danger <danger@FreeBSD.org> | 2011-07-26 00:15:50 +0800 |
commit | b4165eac5887e95d2b1bd12521bc1fff2d7650a7 (patch) | |
tree | fb919728bd5334a0e5f219de822e466b02587555 | |
parent | d1ecb1dbc0dc337f3eb596bed519a2025262ad63 (diff) | |
download | freebsd-ports-gnome-b4165eac5887e95d2b1bd12521bc1fff2d7650a7.tar.gz freebsd-ports-gnome-b4165eac5887e95d2b1bd12521bc1fff2d7650a7.tar.zst freebsd-ports-gnome-b4165eac5887e95d2b1bd12521bc1fff2d7650a7.zip |
- install uwsgidecorators.py as well [1]
- improve the rc.d script - allow multiple instances etc (see PR) [2]
PR: ports/156723 [2]
Submitted by: Luka Lalinsky <lalinsky@gmail.com> [2]
Requested by: Attila Nagy <bra@fsn.hu> [1]
-rw-r--r-- | www/uwsgi/Makefile | 5 | ||||
-rw-r--r-- | www/uwsgi/files/uwsgi.in | 62 |
2 files changed, 62 insertions, 5 deletions
diff --git a/www/uwsgi/Makefile b/www/uwsgi/Makefile index 25cdc60b2b72..b24d92b94c06 100644 --- a/www/uwsgi/Makefile +++ b/www/uwsgi/Makefile @@ -7,6 +7,7 @@ PORTNAME= uwsgi PORTVERSION= 0.9.8.3 +PORTREVISION= 1 CATEGORIES= www python MASTER_SITES= http://projects.unbit.it/downloads/ @@ -22,12 +23,14 @@ USE_GNOME= libxml2 USE_PYTHON= yes USE_RC_SUBR= uwsgi -PLIST_FILES= bin/${PORTNAME} +PLIST_FILES= bin/${PORTNAME} \ + ${PYTHON_SITELIBDIR}/uwsgidecorators.py .include <bsd.port.pre.mk> do-install: @${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${PREFIX}/bin/ + @${INSTALL_DATA} ${WRKSRC}/uwsgidecorators.py ${PYTHON_SITELIBDIR} .if ${OSVERSION} < 700000 BROKEN= does not build on 6.X diff --git a/www/uwsgi/files/uwsgi.in b/www/uwsgi/files/uwsgi.in index a1464ac4e22b..9b869142e47e 100644 --- a/www/uwsgi/files/uwsgi.in +++ b/www/uwsgi/files/uwsgi.in @@ -22,6 +22,15 @@ # Default is 80. # uwsgi_flags (str): Set the uwsgi command line arguments # Default is "-M -L". +# +# If you would like to have multiple uWSGI instances running, you can +# define multiple profiles: +# +# uwsgi_profiles (str): Set the list of uwsgi profiles +# Default is "". +# +# For each profile you can then define different options (except for +# uwsgi_enable) using the syntax uwsgi_<profile>_<option> . /etc/rc.subr @@ -31,6 +40,7 @@ rcvar=`set_rcvar` load_rc_config $name : ${uwsgi_enable="NO"} +: ${uwsgi_profiles=""} : ${uwsgi_socket="/tmp/${name}.sock"} : ${uwsgi_logfile="/var/log/${name}.log"} : ${uwsgi_pidfile="/var/run/${name}.pid"} @@ -38,13 +48,48 @@ load_rc_config $name : ${uwsgi_gid="80"} : ${uwsgi_flags="-M -L"} +is_uwsgi_profile() { + local profile + + for profile in $uwsgi_profiles; do + if [ "$profile" = "$1" ]; then + return 0 + fi + done + + return 1 +} + +if [ -n "${uwsgi_profiles}" ]; then + if [ -n "$2" ]; then + profile="$2" + if ! is_uwsgi_profile $profile; then + echo "$0: no such profile defined in uwsgi_profiles." + exit 1 + fi + eval uwsgi_socket=\${uwsgi_${profile}_socket:-"/tmp/${name}-${profile}.sock"} + eval uwsgi_logfile=\${uwsgi_${profile}_logfile:-"/var/log/${name}-${profile}.log"} + eval uwsgi_pidfile=\${uwsgi_${profile}_pidfile:-"/var/run/${name}-${profile}.pid"} + eval uwsgi_uid=\${uwsgi_${profile}_uid:-"${uwsgi_uid}"} + eval uwsgi_gid=\${uwsgi_${profile}_gid:-"${uwsgi_uid}"} + eval uwsgi_flags=\${uwsgi_${profile}_flags:-"${uwsgi_flags}"} + elif [ -n "$1" ]; then + for profile in ${uwsgi_profiles}; do + echo "Processing ${name} profile: ${profile}" + $0 $1 ${profile} + done + exit 0 + fi +fi + command=%%PREFIX%%/bin/uwsgi command_args="--pidfile ${uwsgi_pidfile} -s ${uwsgi_socket} -d ${uwsgi_logfile} --uid ${uwsgi_uid} --gid ${uwsgi_gid} ${uwsgi_flags}" +pidfile=${uwsgi_pidfile} stop_postcmd=stop_postcmd reload_precmd=reload_precmd -sig_reload="TERM" -sig_stop="KILL" -extra_commands="reload" +brutalreload_cmd=brutalreload_cmd +sig_stop="INT" +extra_commands="reload brutalreload" stop_postcmd() { @@ -53,7 +98,16 @@ stop_postcmd() reload_precmd() { - echo "Restarting ${name} gracefully without closing the main sockets." + echo "Gracefully reloading ${name} without closing the main sockets." +} + +brutalreload_cmd() +{ + echo "Reloading ${name} without closing the main sockets." + + reload_precmd="" + sig_reload="TERM" + run_rc_command ${rc_prefix}reload $rc_extra_args || return 1 } run_rc_command "$1" |