75 /* |
75 /* |
76 * SIGUSR1: reload the configuration files |
76 * SIGUSR1: reload the configuration files |
77 */ |
77 */ |
78 void sig_usr1_reload(int sig) { |
78 void sig_usr1_reload(int sig) { |
79 log_ereport(LOG_INFORM, "sig reload"); |
79 log_ereport(LOG_INFORM, "sig reload"); |
80 |
80 (void)webserver_reconfig(); |
81 CfgManager mgr; |
|
82 if(cfgmgr_load_config(&mgr) != 0) { |
|
83 log_ereport(LOG_FAILURE, "cannot reload server.conf"); |
|
84 } else { |
|
85 if(cfgmgr_apply_config(&mgr)) { |
|
86 log_ereport(LOG_FAILURE, "cannot reload config"); |
|
87 } |
|
88 } |
|
89 |
|
90 // start newly created listeners |
|
91 start_all_listener(); |
|
92 |
|
93 signal(SIGUSR1, sig_usr1_reload); |
81 signal(SIGUSR1, sig_usr1_reload); |
94 } |
82 } |
95 |
83 |
96 /* |
84 /* |
97 * SIGTERM: stop the server |
85 * SIGTERM: stop the server |
322 for(int i=0;i<3;i++) { |
309 for(int i=0;i<3;i++) { |
323 close(i); |
310 close(i); |
324 } |
311 } |
325 |
312 |
326 dup2(std_out[1], 1); |
313 dup2(std_out[1], 1); |
327 //dup2(std_err[1], 2); |
314 dup2(std_err[1], 2); |
328 close(std_out[1]); |
315 close(std_out[1]); |
329 //close(std_err[1]); |
316 close(std_err[1]); |
330 |
317 |
331 // set log thread stack size |
318 // set log thread stack size |
332 pthread_attr_t tattr; |
319 pthread_attr_t tattr; |
333 pthread_attr_init(&tattr); |
320 pthread_attr_init(&tattr); |
334 pthread_attr_setstacksize(&tattr, LOG_THREAD_STACK_SIZE); |
321 pthread_attr_setstacksize(&tattr, LOG_THREAD_STACK_SIZE); |