Created
June 4, 2015 16:09
-
-
Save hoelzro/66c4d2670ee447491975 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use feature qw(say); | |
sub sighandler { | |
my ( $name ) = @_; | |
return sub { | |
open my $fh, '>', '/tmp/result'; | |
say {$fh} "got signal $name"; | |
close $fh; | |
exit 0; | |
}; | |
} | |
$SIG{TERM} = sighandler('TERM'); | |
$SIG{INT} = sighandler('INT'); | |
$SIG{HUP} = sighandler('HUP'); | |
sleep 60; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment