added --daemonize2

This commit is contained in:
roberto@precise64
2012-03-02 07:31:20 +01:00
parent bb7456e3f8
commit c72889c10f
4 changed files with 22 additions and 1 deletions
+1
View File
@@ -172,6 +172,7 @@ int event_queue_init() {
int epfd;
epfd = epoll_create(256);
if (epfd < 0) {
-1
View File
@@ -180,7 +180,6 @@ void daemonize(char *logfile) {
exit(1);
} */
fdin = open("/dev/null", O_RDWR);
if (fdin < 0) {
uwsgi_error_open("/dev/null");
+20
View File
@@ -81,6 +81,7 @@ static struct uwsgi_option uwsgi_base_options[] = {
{"inherit", required_argument, 0, "use the specified file as config template", uwsgi_opt_load, NULL,0},
{"daemonize", required_argument, 'd', "daemonize uWSGI", uwsgi_opt_set_str, &uwsgi.daemonize, 0},
{"daemonize2", required_argument, 0, "daemonize uWSGI after app loading", uwsgi_opt_set_str, &uwsgi.daemonize2, 0},
{"stop", required_argument, 0, "stop an instance", uwsgi_opt_pidfile_signal, (void *) SIGINT, UWSGI_OPT_IMMEDIATE},
{"reload", required_argument, 0, "reload an instance", uwsgi_opt_pidfile_signal, (void *) SIGHUP, UWSGI_OPT_IMMEDIATE},
{"pause", required_argument, 0, "pause an instance", uwsgi_opt_pidfile_signal, (void *) SIGTSTP, UWSGI_OPT_IMMEDIATE},
@@ -2579,6 +2580,25 @@ skipzero:
uwsgi_init_all_apps();
}
if (uwsgi.daemonize2) {
if (uwsgi.has_emperor) {
logto(uwsgi.daemonize2);
}
else {
if (!uwsgi.is_a_reload) {
uwsgi_log("*** daemonizing uWSGI ***\n");
daemonize(uwsgi.daemonize2);
}
else if (uwsgi.log_reopen) {
logto(uwsgi.daemonize2);
}
}
uwsgi.mypid = getpid();
masterpid = uwsgi.mypid;
uwsgi.workers[0].pid = masterpid;
}
if (uwsgi.no_server) {
uwsgi_log("no-server mode requested. Goodbye.\n");
exit(0);
+1
View File
@@ -1240,6 +1240,7 @@ struct uwsgi_server {
int check_static_docroot;
char *daemonize;
char *daemonize2;
int do_not_change_umask;
char *logfile;
int logfile_chown;