mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-04 20:51:29 +00:00
Write pidfile and pidfile2 only after successful start
This commit is contained in:
@@ -3587,6 +3587,13 @@ void uwsgi_write_pidfile(char *pidfile_name) {
|
||||
}
|
||||
}
|
||||
|
||||
void uwsgi_write_pidfile_explicit(char *pidfile_name, pid_t pid) {
|
||||
uwsgi_log("writing pidfile to %s\n", pidfile_name);
|
||||
if (uwsgi_write_intfile(pidfile_name, (int) pid)) {
|
||||
uwsgi_log("could not write pidfile.\n");
|
||||
}
|
||||
}
|
||||
|
||||
char *uwsgi_expand_path(char *dir, int dir_len, char *ptr) {
|
||||
char src[PATH_MAX + 1];
|
||||
memcpy(src, dir, dir_len);
|
||||
|
||||
+7
-8
@@ -2420,10 +2420,6 @@ configure:
|
||||
uwsgi_log("*** running under screen session %s ***\n", uwsgi.screen_session);
|
||||
}
|
||||
|
||||
if (uwsgi.pidfile && !uwsgi.is_a_reload) {
|
||||
uwsgi_write_pidfile(uwsgi.pidfile);
|
||||
}
|
||||
|
||||
uwsgi_log_initial("detected binary path: %s\n", uwsgi.binary_path);
|
||||
|
||||
if (uwsgi.is_a_reload) {
|
||||
@@ -2523,6 +2519,10 @@ configure:
|
||||
#if defined(__linux__) && !defined(__ia64__)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (uwsgi.pidfile && !uwsgi.is_a_reload) {
|
||||
uwsgi_write_pidfile_explicit(uwsgi.pidfile, masterpid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2595,10 +2595,6 @@ int uwsgi_start(void *v_argv) {
|
||||
}
|
||||
}
|
||||
|
||||
if (uwsgi.pidfile2 && !uwsgi.is_a_reload) {
|
||||
uwsgi_write_pidfile(uwsgi.pidfile2);
|
||||
}
|
||||
|
||||
if (!uwsgi.master_process && !uwsgi.command_mode) {
|
||||
uwsgi_log_initial("*** WARNING: you are running uWSGI without its master process manager ***\n");
|
||||
}
|
||||
@@ -3258,6 +3254,9 @@ next2:
|
||||
}
|
||||
}
|
||||
|
||||
if (uwsgi.pidfile2 && !uwsgi.is_a_reload) {
|
||||
uwsgi_write_pidfile_explicit(uwsgi.pidfile2, masterpid);
|
||||
}
|
||||
|
||||
// END OF INITIALIZATION
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user