From c6fb7f86b976b33d5b19db27ee8e7e4efd269fa8 Mon Sep 17 00:00:00 2001 From: jjh Date: Sun, 17 May 2009 21:11:07 +0000 Subject: [PATCH] init script updates from Gena Makhomed --- nginx-upstream-fair.tgz | Bin 6824 -> 0 bytes nginx.init | 58 ++++++++++++++++++++++++++++------------ nginx.spec | 44 ++++++++++++++---------------- upstream-fair.conf | 18 ------------- 4 files changed, 61 insertions(+), 59 deletions(-) delete mode 100644 nginx-upstream-fair.tgz delete mode 100644 upstream-fair.conf diff --git a/nginx-upstream-fair.tgz b/nginx-upstream-fair.tgz deleted file mode 100644 index 73147a021ac1ba273792233a78b53b90ec965e0a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6824 zcmV;Z8dv2XiwFR5eb;@i)Eg{r#QoN00U%@4)lkWD&(7x96RS?S|dE9s}3I{{C+D`iI~7^}oNj^UdyEBT{z# zm#_b_`9B{VoxB>{-55guKdzepot^!H{@>kuy#LMb!o>gb`9H(?XK&^Fv+rU4*_$x< zc*9->w!@y=p6!o$*ywZ`jT0V?Lw6Cof&Y{qT+TQX08nn&g8GeQ7smY={)ku%&4A0k zV}}k4gT!|_VK8!i=HU=&d+2`UI^1boyYWoIjRNRx$IOk{wd;8-4(;&=HcBEK2Yzwi zVG$3nco?xJ-#G@@sK}l z%;I?QwA&qpw(Ca=Z_AFmb{M;3k4N1dP?p_Zue<#}U7OZphah(p(9R?XJ7U=a_|9Aq z*=RIQePFWZ+1dR35+o0RX+GyfZpb@e>ldz<&RQ7EfyGIPdc&C0 zM3pt>_6JV?0dd3~;M3d4o^rvUW024(7bppe1QKilWIl+P0>(yO0Mcggh_eSc#Dk1j zpd#%cr-l92U~pl>KK+uC*4x?N+J=9SCLCBY0l3IYkmC=;N09G-00$YYbHMzEWJK#G zN=9>_W08Oahy2%sM{&dg5}omkmgpa?JO4jiWfL#fz}=0p!v1gX>=*pMz20u`Py7En zT>kXq5VUIG4}E*i5Ac@Mu9Ao$N`zFvjUO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>8~T%C1%=7JHa>l7#AhG#$Zhtpq1F$}F8}_o}#7 zpC>vPS({m=s47nj$so(WQXsohD zuG<(zp!r@^@oFfPHB&pD_*B)E<}y_U$t}%QnP9~yMP0EySlo`UXuPVLRhuHsifU(r zmsruw;-p#y6}xQJtd}vq!_OVAouOHo7mhUZ*V1PmlRFS?svgE61uY-&ulCNSr(qZd z!+)hh0x?vHojV~e+;`!QP+`09rR~JOr*Xa<$6mV*0YdL{+S(;eV#mpx#MSnyQ(C_( zpGNjwc>rO;uIq&`Px^E0&daoeex%lee4|xoua9ITS0e5I2vw628&VysF4B5$hUNzf z86J7s*B@sY{>F-9YjpN*EY@$FZF$?`+zH7~SU8J{!SF)sq)X<1jYnC+XU#DijE`I~ zP>fD3t*x;{P^`tQjKrIK`1_FO)Jh)RS+(iYLU-zUut1&7O*OI!EYamWtfKOuo%5f= zGRfgQg;EBqHz9WE!IRme@kNbAv@zSqUDGL%J=Nd!*-W}O?TF@!>o~m{-erF5-S6xhw${JDJUtX`_Otz9rKw;n@z&I`V#$N2wT9Yi zLV2n>4l=Ct(NsRJZi_$B=Y`nyejkfjTy|S7D&sJx-#FQcVif!PPL~o%%B^`!F&s*( zwDN)`$3jG}kDuY~XR(&N2X1@-7q8H=>QO`8u/dev/null 2>&1 +} + rh_status() { status $prog } @@ -78,6 +77,29 @@ rh_status_q() { rh_status >/dev/null 2>&1 } +# Upgrade the binary with no downtime. +upgrade() { + local pidfile="/var/run/${prog}.pid" + local oldbin_pidfile="${pidfile}.oldbin" + + configtest_q || configtest || return 6 + echo -n $"Staring new master $prog: " + killproc $nginx -USR2 + retval=$? + echo + sleep 1 + if [[ -f ${oldbin_pidfile} && -f ${pidfile} ]]; then + echo -n $"Graceful shutdown of old $prog: " + killproc -p ${oldbin_pidfile} -QUIT + retval=$? + echo + return 0 + else + echo $"Something bad happened, manual intervention required, maybe restart?" + return 1 + fi +} + case "$1" in start) rh_status_q && exit 0 @@ -90,20 +112,22 @@ case "$1" in restart|configtest) $1 ;; + force-reload|upgrade) + rh_status_q || exit 7 + upgrade + ;; reload) rh_status_q || exit 7 $1 ;; - force-reload) - force_reload - ;; - status) - rh_status + status|status_q) + rh_$1 ;; condrestart|try-restart) - rh_status_q || exit 0 + rh_status_q || exit 7 + restart ;; *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" + echo $"Usage: $0 {start|stop|reload|configtest|status|force-reload|upgrade|restart}" exit 2 esac diff --git a/nginx.spec b/nginx.spec index 5569b89..0e2afe6 100644 --- a/nginx.spec +++ b/nginx.spec @@ -9,7 +9,7 @@ Name: nginx Version: 0.6.36 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Robust, small and high performance http and reverse proxy server Group: System Environment/Daemons @@ -34,9 +34,7 @@ Source1: %{name}.init Source2: %{name}.logrotate Source3: virtual.conf Source4: ssl.conf -Source5: nginx-upstream-fair.tgz -Source6: upstream-fair.conf -Source7: %{name}.sysconfig +Source5: %{name}.sysconfig Source100: index.html Source101: poweredby.png Source102: nginx-logo.png @@ -53,17 +51,13 @@ Patch1: nginx-conf.patch %description Nginx [engine x] is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 -proxy server written by Igor Sysoev. - -One third party module, nginx-upstream-fair, is added - +proxy server written by Igor Sysoev. %prep %setup -q %patch0 -p0 %patch1 -p0 -%{__tar} zxvf %{SOURCE5} %build # nginx does not utilize a standard configure script. It has its own @@ -96,14 +90,9 @@ export DESTDIR=%{buildroot} --with-http_perl_module \ --with-mail \ --with-mail_ssl_module \ - --with-cc-opt="%{optflags} $(pcre-config --cflags)" \ - --add-module=%{_builddir}/nginx-%{version}/nginx-upstream-fair + --with-cc-opt="%{optflags} $(pcre-config --cflags)" make %{?_smp_mflags} -# rename the readme for nginx-upstream-fair so it doesn't conflict with the main -# readme -mv nginx-upstream-fair/README nginx-upstream-fair/README.nginx-upstream-fair - %install rm -rf %{buildroot} make install DESTDIR=%{buildroot} INSTALLDIRS=vendor @@ -115,15 +104,14 @@ find %{buildroot} -type f -name '*.so' -exec chmod 0755 {} \; chmod 0755 %{buildroot}%{_sbindir}/nginx %{__install} -p -D -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name} %{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} -%{__install} -p -D -m 0644 %{SOURCE7} %{buildroot}%{_sysconfdir}/sysconfig/%{name} +%{__install} -p -D -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/sysconfig/%{name} %{__install} -p -d -m 0755 %{buildroot}%{nginx_confdir}/conf.d -%{__install} -p -m 0644 %{SOURCE3} %{SOURCE4} %{SOURCE6} %{buildroot}%{nginx_confdir}/conf.d +%{__install} -p -m 0644 %{SOURCE3} %{SOURCE4} %{buildroot}%{nginx_confdir}/conf.d %{__install} -p -d -m 0755 %{buildroot}%{nginx_home_tmp} %{__install} -p -d -m 0755 %{buildroot}%{nginx_logdir} %{__install} -p -d -m 0755 %{buildroot}%{nginx_webroot} %{__install} -p -m 0644 %{SOURCE100} %{SOURCE101} %{SOURCE102} %{SOURCE103} %{SOURCE104} %{buildroot}%{nginx_webroot} - # convert to UTF-8 all files that give warnings. for textfile in CHANGES do @@ -136,10 +124,14 @@ done rm -rf %{buildroot} %pre -%{_sbindir}/useradd -c "Nginx user" -s /bin/false -r -d %{nginx_home} %{nginx_user} 2>/dev/null || : +if [ $1 == 1 ]; then + %{_sbindir}/useradd -c "Nginx user" -s /bin/false -r -d %{nginx_home} %{nginx_user} 2>/dev/null || : +fi %post -/sbin/chkconfig --add %{name} +if [ $1 == 1 ]; then + /sbin/chkconfig --add %{name} +fi %preun if [ $1 = 0 ]; then @@ -148,13 +140,13 @@ if [ $1 = 0 ]; then fi %postun -if [ $1 -ge 1 ]; then - /sbin/service %{name} condrestart > /dev/null 2>&1 || : +if [ $1 == 2 ]; then + /sbin/service %{name} upgrade || : fi %files %defattr(-,root,root,-) -%doc LICENSE CHANGES README nginx-upstream-fair/README.nginx-upstream-fair +%doc LICENSE CHANGES README %{nginx_datadir}/ %{_sbindir}/%{name} %{_mandir}/man3/%{name}.3pm.gz @@ -182,7 +174,11 @@ fi %changelog -* Sat Apr 11 2009 Jeremy Hinegardner 0.6.36-1 +* Sun May 17 2009 Jeremy Hinegardner - 0.6.36-2 +- init script updates from Gena Makhomed +- remove nginx-upstream-fair + +* Sat Apr 11 2009 Jeremy Hinegardner - 0.6.36-1 - update to 0.6.36 * Wed Feb 25 2009 Fedora Release Engineering - 0.6.35-3 diff --git a/upstream-fair.conf b/upstream-fair.conf deleted file mode 100644 index 3909e96..0000000 --- a/upstream-fair.conf +++ /dev/null @@ -1,18 +0,0 @@ -# -# This is a sample configuration to use the nginx-upstream-fair module -# that is included. -# -# http://wiki.codemongers.com/NginxHttpUpstreamFairModule -# -# Change your Nginx config file's upstream block to include the 'fair' -# directive: -# - -# upstream mongrel { -# fair; -# server 127.0.0.1:5000; -# server 127.0.0.1:5001; -# server 127.0.0.1:5002; -# } - -