From d6400134ea21d19f8889d079d8eccdadab5e4437 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 18 Apr 2008 16:12:52 +0000 Subject: [PATCH] Force exit of processes on SIGTERM with 5 second clean-shutdown grace period git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1116 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/sbin/xcatd | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xCAT-server-2.0/sbin/xcatd b/xCAT-server-2.0/sbin/xcatd index 9630aba15..9812bcfd0 100755 --- a/xCAT-server-2.0/sbin/xcatd +++ b/xCAT-server-2.0/sbin/xcatd @@ -375,7 +375,12 @@ unless ($foreground) { daemonize; } $SIG{CHLD} = sub { while (waitpid(-1,WNOHANG) > 0) {} }; -$SIG{TERM} = $SIG{INT} = sub { printf("Asked to quit...\n"); $quit++ }; +$SIG{TERM} = $SIG{INT} = sub { + printf("Asked to quit...\n"); + $quit++; + $SIG{ALRM} = sub { die "Did not close out in time for 5 second grace period"; }; + alarm(5); + }; my $pid = xCAT::Utils->xfork; defined $pid or die "Unable to fork for UDP/TCP";