New post_crash_dump_hook

Run it from crash_dump().  Useful to move core files out of the way,
alert deities by e-mail, and so forth.
This commit is contained in:
Markus Armbruster 2008-04-25 22:12:22 +02:00
parent dd0737f8e7
commit f63401329d
5 changed files with 7 additions and 2 deletions

View file

@ -90,6 +90,8 @@ EMPCFBOTH("port", loginport, char *, NSC_STRING, KM_INTERNAL,
"TCP port the server will bind") "TCP port the server will bind")
EMPCFBOTH("keep_journal", keep_journal, int, NSC_INT, KM_INTERNAL, EMPCFBOTH("keep_journal", keep_journal, int, NSC_INT, KM_INTERNAL,
"Enable journal log file") "Enable journal log file")
EMPCFBOTH("post_crash_dump_hook", post_crash_dump_hook, char *, NSC_STRING, KM_INTERNAL,
"Shell command run right after a crash dump, in the game's data directory")
EMPCFBOTH("privname", privname, char *, NSC_STRING, 0, EMPCFBOTH("privname", privname, char *, NSC_STRING, 0,
"Name of the deity") "Name of the deity")
EMPCFBOTH("privlog", privlog, char *, NSC_STRING, 0, EMPCFBOTH("privlog", privlog, char *, NSC_STRING, 0,

View file

@ -49,6 +49,7 @@ void update_main(void);
void update_init(void); void update_init(void);
int update_trigger(void); int update_trigger(void);
int update_reschedule(void); int update_reschedule(void);
int run_hook(char *, char *);
int shutdown_initiate(int); int shutdown_initiate(int);
/* thread entry points */ /* thread entry points */

View file

@ -44,6 +44,8 @@ char *privlog = "careless@invalid";
/* Divine hosts and networks */ /* Divine hosts and networks */
char *privip = "127.0.0.1 ::1 ::ffff:127.0.0.1"; char *privip = "127.0.0.1 ::1 ::ffff:127.0.0.1";
char *post_crash_dump_hook = "";
char *disabled_commands = ""; char *disabled_commands = "";
int keep_journal = 0; /* journal log file enabled */ int keep_journal = 0; /* journal log file enabled */

View file

@ -340,6 +340,7 @@ crash_dump(void)
return; return;
} }
} }
run_hook(post_crash_dump_hook, "post-crash-dump");
logerror("Crash dump complete"); logerror("Crash dump complete");
#endif #endif
} }

View file

@ -63,7 +63,6 @@ static empth_t *update_thread;
static int update_get_schedule(void); static int update_get_schedule(void);
static void update_sched(void *); static void update_sched(void *);
static void update_run(void); static void update_run(void);
static int run_hook(char *cmd, char *name);
void void
update_init(void) update_init(void)
@ -218,7 +217,7 @@ update_run(void)
empth_rwlock_unlock(play_lock); empth_rwlock_unlock(play_lock);
} }
static int int
run_hook(char *cmd, char *name) run_hook(char *cmd, char *name)
{ {
int status; int status;