Refuse to die
examples/linux/refuse_to_die.pl
#!/usr/bin/perl use strict; use warnings; print "Process ID: $$\n"; $SIG{INT} = sub { print "\nINT - I don't want to die!!!\n" }; $SIG{TERM} = sub { print "\nTERM - Don't terminate me!!!\n" }; $SIG{TSTP} = sub { print "\nTTP - No background check for me!!!\n" }; sleep 1 while 1;
- Run the above program
- Press Ctrl-C
- from another window run kill PID
- from another window run kill -15 PID
- from another window run kill -2 PID
- from another window run kill -9 PID
- Run it again
- Ctrl-Z
- kill -20 POD