Add hook to call shutdown script

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
Claudio Matsuoka committed 2010-07-14 18:09:16 -03:00
1 parent 6afbcbdd6e
commit f92438d42a
1 file changed
+9 -1
+9 -1
View File
@@ -127,7 +127,7 @@ void signal_handler(int);
void chld_handler(int);
static int debug = 0;
static char sdown[CMD_SIZE];
static void build_cmd(char *cmd, char *x, int len)
{
@@ -293,6 +293,11 @@ int main()
build_cmd(hostname, x, HOSTNAME_SIZE);
continue;
}
if (MATCH_CMD(line, "shutdown ", x)) {
*sdown = 0;
build_cmd(sdown, x, CMD_SIZE);
continue;
}
if (MATCH_CMD(line, "module ", x)) {
strcpy(cmd, "/sbin/modprobe ");
build_cmd(cmd, x, CMD_SIZE);
@@ -574,6 +579,9 @@ int main()
void shutdown(int sig)
{
touch("/tmp/shutdown");
if (sdown) {
system(sdown);
}
kill(-1, SIGTERM);