]> git.pond.sub.org Git - empserver/commitdiff
New post_crash_dump_hook
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 25 Apr 2008 20:12:22 +0000 (22:12 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 25 Apr 2008 20:12:22 +0000 (22:12 +0200)
Run it from crash_dump().  Useful to move core files out of the way,
alert deities by e-mail, and so forth.

include/econfig-spec.h
include/server.h
src/lib/global/constants.c
src/server/main.c
src/server/update.c

index ee54f82948d4be44f7ccb50faffd7969483838a7..bc4ccc6a9ccc6d3043f65e5d5bffd286c16c0ba7 100644 (file)
@@ -90,6 +90,8 @@ EMPCFBOTH("port", loginport, char *, NSC_STRING, KM_INTERNAL,
     "TCP port the server will bind")
 EMPCFBOTH("keep_journal", keep_journal, int, NSC_INT, KM_INTERNAL,
     "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,
     "Name of the deity")
 EMPCFBOTH("privlog", privlog, char *, NSC_STRING, 0,
index 3bb88196c5df05edb13d425e3cb2287c2d537dfb..bd87510ed0ad725cf727cc60c9e6bffe122ddc6f 100644 (file)
@@ -49,6 +49,7 @@ void update_main(void);
 void update_init(void);
 int update_trigger(void);
 int update_reschedule(void);
+int run_hook(char *, char *);
 int shutdown_initiate(int);
 
 /* thread entry points */
index 97bc28fc3afd3b77eba17aac5efb19504cf50f8d..62ee91caf44195fa1acf1a228c125a7b828d2319 100644 (file)
@@ -44,6 +44,8 @@ char *privlog = "careless@invalid";
 /* Divine hosts and networks */
 char *privip = "127.0.0.1 ::1 ::ffff:127.0.0.1";
 
+char *post_crash_dump_hook = "";
+
 char *disabled_commands = "";
 
 int keep_journal = 0;          /* journal log file enabled */
index cc8e669932656b54cc94dd1c6ef985b7368aa5fe..03c5b1535ee062ed1ed72cecef13d48b8e4527d6 100644 (file)
@@ -340,6 +340,7 @@ crash_dump(void)
            return;
        }
     }
+    run_hook(post_crash_dump_hook, "post-crash-dump");
     logerror("Crash dump complete");
 #endif
 }
index 06124f43df5356cffe0ca9e347fe0fa902919279..5477c0d429157c8edf93ffd5702e9aceedfb6bd6 100644 (file)
@@ -63,7 +63,6 @@ static empth_t *update_thread;
 static int update_get_schedule(void);
 static void update_sched(void *);
 static void update_run(void);
-static int run_hook(char *cmd, char *name);
 
 void
 update_init(void)
@@ -218,7 +217,7 @@ update_run(void)
     empth_rwlock_unlock(play_lock);
 }
 
-static int
+int
 run_hook(char *cmd, char *name)
 {
     int status;