launch stop hook on emperor quit

This commit is contained in:
roberto@maverick64
2011-07-03 19:16:09 +02:00
parent 545784d7af
commit d5210283ca
2 changed files with 43 additions and 29 deletions
+42 -28
View File
@@ -8,40 +8,54 @@ extern char **environ;
int emperor_queue;
char *emperor_absolute_dir;
struct uwsgi_instance {
struct uwsgi_instance *ui_prev;
struct uwsgi_instance *ui_next;
char name[0xff];
pid_t pid;
int status;
time_t born;
time_t last_mod;
time_t last_loyal;
uint64_t respawns;
int use_config;
int pipe[2];
int pipe_config[2];
char *config;
uint32_t config_len;
int loyal;
int zerg;
};
struct uwsgi_instance *ui;
static void royal_death(int signum) {
if (uwsgi.vassals_stop_hook) {
struct uwsgi_instance *c_ui = ui->ui_next;
while (c_ui) {
uwsgi_log("running vassal stop-hook: %s %s\n", uwsgi.vassals_stop_hook, c_ui->name);
int stop_hook_ret = uwsgi_run_command_and_wait(uwsgi.vassals_stop_hook, c_ui->name);
uwsgi_log("%s stop-hook returned %d\n", c_ui->name, stop_hook_ret);
c_ui = c_ui->ui_next;
}
}
uwsgi_notify("The Emperor is buried.");
exit(0);
}
struct uwsgi_instance {
struct uwsgi_instance *ui_prev;
struct uwsgi_instance *ui_next;
char name[0xff];
pid_t pid;
int status;
time_t born;
time_t last_mod;
time_t last_loyal;
uint64_t respawns;
int use_config;
int pipe[2];
int pipe_config[2];
char *config;
uint32_t config_len;
int loyal;
int zerg;
};
struct uwsgi_instance *ui;
void emperor_stats() {
struct uwsgi_instance *c_ui = ui->ui_next;
+1 -1
View File
@@ -3,7 +3,7 @@
trac = trac.web.main
id = myapp
socket = /tmp/%(id).sock
socket = :3031
socket = :0
env = TRAC_ENV=/opt/projects/%(id)
module = %(trac):dispatch_request
processes = 8