#!perl use strict; use warnings; $SIG{'HUP'}=sub { print "Got a HUP signal\n"; }; $SIG{'TERM'}=sub { print "Got a TERM signal\n"; }; open my $f,'>','pid.txt' or die "Could not write pid.txt: $!"; print $f "$$\n"; close $f; $|=1; print "Waiting to be killed\n"; while (1) { print '.'; sleep 30; }