Skip to content

Commit

Permalink
backported --emperor-procname
Browse files Browse the repository at this point in the history
  • Loading branch information
unbit committed Jan 26, 2013
1 parent 9221e19 commit 8aa739b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/emperor.c
Expand Up @@ -1324,13 +1324,21 @@ void emperor_send_stats(int fd) {
void uwsgi_emperor_start() {

if (!uwsgi.sockets && !ushared->gateways_cnt && !uwsgi.master_process) {
if (uwsgi.emperor_procname) {
uwsgi_set_processname(uwsgi.emperor_procname);
}
uwsgi_notify_ready();
emperor_loop();
// never here
exit(1);
}

uwsgi.emperor_pid = uwsgi_fork("uWSGI Emperor");
if (uwsgi.emperor_procname) {
uwsgi.emperor_pid = uwsgi_fork(uwsgi.emperor_procname);
}
else {
uwsgi.emperor_pid = uwsgi_fork("uWSGI Emperor");
}
if (uwsgi.emperor_pid < 0) {
uwsgi_error("pid()");
exit(1);
Expand Down
1 change: 1 addition & 0 deletions core/uwsgi.c
Expand Up @@ -140,6 +140,7 @@ static struct uwsgi_option uwsgi_base_options[] = {
{"need-app", no_argument, 0, "exit if no app can be loaded", uwsgi_opt_true, &uwsgi.need_app, 0},
{"master", no_argument, 'M', "enable master process", uwsgi_opt_true, &uwsgi.master_process, 0},
{"emperor", required_argument, 0, "run the Emperor", uwsgi_opt_add_string_list, &uwsgi.emperor, 0},
{"emperor-procname", required_argument, 0, "set the Emperor process name", uwsgi_opt_set_str, &uwsgi.emperor_procname, 0},
{"emperor-freq", required_argument, 0, "set the Emperor scan frequency (default 3 seconds)", uwsgi_opt_set_int, &uwsgi.emperor_freq, 0},
{"emperor-required-heartbeat", required_argument, 0, "set the Emperor tolerance about heartbeats", uwsgi_opt_set_int, &uwsgi.emperor_heartbeat, 0},
{"emperor-pidfile", required_argument, 0, "write the Emperor pid in the specified file", uwsgi_opt_set_str, &uwsgi.emperor_pidfile, 0},
Expand Down
1 change: 1 addition & 0 deletions uwsgi.h
Expand Up @@ -1293,6 +1293,7 @@ struct uwsgi_server {

// true if run under the emperor
int has_emperor;
char *emperor_procname;
int emperor_fd;
int emperor_queue;
int emperor_tyrant;
Expand Down

0 comments on commit 8aa739b

Please sign in to comment.