comparison src/core/nginx.c @ 2738:ae81441e23f4

implement "-s signal" option for Unix
author Igor Sysoev <igor@sysoev.ru>
date Tue, 21 Apr 2009 20:25:49 +0000
parents a9d7f8ebdbef
children d8316f307b6a
comparison
equal deleted inserted replaced
2737:d52cf82d0d77 2738:ae81441e23f4
186 static ngx_uint_t ngx_show_help; 186 static ngx_uint_t ngx_show_help;
187 static ngx_uint_t ngx_show_version; 187 static ngx_uint_t ngx_show_version;
188 static ngx_uint_t ngx_show_configure; 188 static ngx_uint_t ngx_show_configure;
189 static u_char *ngx_conf_file; 189 static u_char *ngx_conf_file;
190 static u_char *ngx_conf_params; 190 static u_char *ngx_conf_params;
191 #if (NGX_WIN32)
192 static char *ngx_signal; 191 static char *ngx_signal;
193 #endif
194 192
195 193
196 static char **ngx_os_environ; 194 static char **ngx_os_environ;
197 195
198 196
211 if (ngx_show_version) { 209 if (ngx_show_version) {
212 ngx_log_stderr("nginx version: " NGINX_VER); 210 ngx_log_stderr("nginx version: " NGINX_VER);
213 211
214 if (ngx_show_help) { 212 if (ngx_show_help) {
215 ngx_log_stderr( 213 ngx_log_stderr(
216 "Usage: nginx [-?hvVt]" 214 "Usage: nginx [-?hvVt] [-s signal] [-c filename] "
217 #if (NGX_WIN32) 215 "[-g directives]" CRLF CRLF
218 " [-s signal]"
219 #endif
220 " [-c filename] [-g directives]" CRLF CRLF
221 "Options:" CRLF 216 "Options:" CRLF
222 " -?,-h : this help" CRLF 217 " -?,-h : this help" CRLF
223 " -v : show version and exit" CRLF 218 " -v : show version and exit" CRLF
224 " -V : show version and configure options then exit" 219 " -V : show version and configure options then exit"
225 CRLF 220 CRLF
226 " -t : test configuration and exit" CRLF 221 " -t : test configuration and exit" CRLF
227 #if (NGX_WIN32) 222 " -s signal : send signal to a master process: "
228 " -s signal : send signal to a master process" CRLF 223 "stop, quit, reopen, reload" CRLF
229 #endif
230 " -c filename : set configuration file (default: " 224 " -c filename : set configuration file (default: "
231 NGX_CONF_PATH ")" CRLF 225 NGX_CONF_PATH ")" CRLF
232 " -g directives : set global directives out of configuration " 226 " -g directives : set global directives out of configuration "
233 "file" CRLF 227 "file" CRLF
234 ); 228 );
335 329
336 if (ccf->master && ngx_process == NGX_PROCESS_SINGLE) { 330 if (ccf->master && ngx_process == NGX_PROCESS_SINGLE) {
337 ngx_process = NGX_PROCESS_MASTER; 331 ngx_process = NGX_PROCESS_MASTER;
338 } 332 }
339 333
340 #if (NGX_WIN32)
341
342 if (ngx_signal) { 334 if (ngx_signal) {
343 return ngx_signal_process(cycle, ngx_signal); 335 return ngx_signal_process(cycle, ngx_signal);
344 } 336 }
345 337
346 #else 338 #if !(NGX_WIN32)
347 339
348 if (ngx_init_signals(cycle->log) != NGX_OK) { 340 if (ngx_init_signals(cycle->log) != NGX_OK) {
349 return 1; 341 return 1;
350 } 342 }
351 343
683 } 675 }
684 676
685 ngx_log_stderr("the option \"-g\" requires parameter"); 677 ngx_log_stderr("the option \"-g\" requires parameter");
686 return NGX_ERROR; 678 return NGX_ERROR;
687 679
688 #if (NGX_WIN32)
689 case 's': 680 case 's':
690 if (*p) { 681 if (*p) {
691 ngx_signal = (char *) p; 682 ngx_signal = (char *) p;
692 683
693 } else if (argv[++i]) { 684 } else if (argv[++i]) {
707 goto next; 698 goto next;
708 } 699 }
709 700
710 ngx_log_stderr("invalid option: \"-s %s\"", ngx_signal); 701 ngx_log_stderr("invalid option: \"-s %s\"", ngx_signal);
711 return NGX_ERROR; 702 return NGX_ERROR;
712 #endif
713 703
714 default: 704 default:
715 ngx_log_stderr("invalid option: \"%c\"", *(p - 1)); 705 ngx_log_stderr("invalid option: \"%c\"", *(p - 1));
716 return NGX_ERROR; 706 return NGX_ERROR;
717 } 707 }