From owner-freebsd-ports-bugs@FreeBSD.ORG Sat Jul 19 09:50:03 2008 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27213106566C for ; Sat, 19 Jul 2008 09:50:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E11998FC14 for ; Sat, 19 Jul 2008 09:50:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m6J9o28A097654 for ; Sat, 19 Jul 2008 09:50:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m6J9o272097653; Sat, 19 Jul 2008 09:50:02 GMT (envelope-from gnats) Resent-Date: Sat, 19 Jul 2008 09:50:02 GMT Resent-Message-Id: <200807190950.m6J9o272097653@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Maxim Dounin Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F51F1065678 for ; Sat, 19 Jul 2008 09:40:41 +0000 (UTC) (envelope-from mdounin@mdounin.ru) Received: from mdounin.cust.ramtel.ru (mdounin.cust.ramtel.ru [81.19.69.81]) by mx1.freebsd.org (Postfix) with ESMTP id 2F3918FC14 for ; Sat, 19 Jul 2008 09:40:40 +0000 (UTC) (envelope-from mdounin@mdounin.ru) Received: by mdounin.cust.ramtel.ru (Postfix, from userid 1000) id 3D74517051; Sat, 19 Jul 2008 13:40:39 +0400 (MSD) Message-Id: <20080719094039.3D74517051@mdounin.cust.ramtel.ru> Date: Sat, 19 Jul 2008 13:40:39 +0400 (MSD) From: Maxim Dounin To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/125766: [patch] www/nginx-devel - extra command: upgrade X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Maxim Dounin List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Jul 2008 09:50:03 -0000 >Number: 125766 >Category: ports >Synopsis: [patch] www/nginx-devel - extra command: upgrade >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Jul 19 09:50:02 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Maxim Dounin >Release: FreeBSD 7.0-RC2 i386 >Organization: >Environment: System: FreeBSD mdounin.cust.ramtel.ru 7.0-RC2 FreeBSD 7.0-RC2 #1: Mon Feb 18 19:55:43 MSK 2008 root@mdounin.cust.ramtel.ru:/usr/obj/usr/src/sys/GENERIC i386 >Description: Extra command to rc script: upgrade. Runs simple form of nginx binary upgrade procedure, allowing to change binary on-the-fly without loosing any single request. >How-To-Repeat: >Fix: # HG changeset patch # User Maxim Dounin # Date 1216436541 -14400 # Node ID 8d0ab4f3900bb4e6fdb22564ff2b33ee2f49e33a # Parent 695fa767cf2984222d07b57f288c27f1d54c9706 Extra command: upgrade. Runs simple form of nginx binary upgrade procedure, allowing to change binary on-the-fly without loosing any single request. diff --git a/files/nginx.sh.in b/files/nginx.sh.in --- a/files/nginx.sh.in +++ b/files/nginx.sh.in @@ -28,6 +28,8 @@ restart_precmd="nginx_checkconfig" restart_precmd="nginx_checkconfig" reload_precmd="nginx_checkconfig" configtest_cmd="nginx_checkconfig" +upgrade_precmd="nginx_checkconfig" +upgrade_cmd="nginx_upgrade" command="%%PREFIX%%/sbin/nginx" _pidprefix="/var/run/nginx" pidfile="${_pidprefix}.pid" @@ -89,6 +91,23 @@ nginx_checkconfig() eval ${command} ${nginx_flags} -t } +nginx_upgrade() +{ + echo "Upgrading nginx binary:" + + reload_precmd="" + sig_reload="USR2" + run_rc_command ${rc_prefix}reload $rc_extra_args || return 1 + + sleep 1 + + echo "Stopping old binary:" + + sig_reload="QUIT" + pidfile="$pidfile.oldbin" + run_rc_command ${rc_prefix}reload $rc_extra_args || return 1 +} + nginx_precmd() { nginx_checkconfig @@ -102,5 +121,5 @@ nginx_precmd() } -extra_commands="reload configtest" +extra_commands="reload configtest upgrade" run_rc_command "$1" >Release-Note: >Audit-Trail: >Unformatted: