Debian Codegraph @

eg/run_daemon

raw
1 #!/usr/bin/perl -w
2
3 ## An example of how to daemonize. See the IPC::Run LIMITATIONS section for
4 ## some reasons why this can be a bit dangerous.
5
6 use strict;
7
8 use IPC::Run qw( run close_terminal );
9
10 run(
11 sub {
12 # ... your code here ...
13 sleep 15;
14 },
15 init => sub {
16 close_terminal;
17 exit if fork;
18 }
19 );