File: run_daemon

package info (click to toggle)
libipc-run-perl 20231003.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 844 kB
  • sloc: perl: 6,255; makefile: 5
file content (19 lines) | stat: -rw-r--r-- 346 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl -w

## An example of how to daemonize.  See the IPC::Run LIMITATIONS section for
## some reasons why this can be a bit dangerous.

use strict;

use IPC::Run qw( run close_terminal );

run(
    sub {
        # ... your code here ...
        sleep 15;
    },
    init => sub {
        close_terminal;
        exit if fork;
    }
);