Pacific-Design.com

    
Home Index

1. Perl5

2. Daemon

+ Service

Perl5 / Daemon /

Perl Daemon

#!/usr/bin/perl
use strict;
use warnings;
use Proc::Daemon;

Proc::Daemon::Init;
my $continue = 1;
$SIG{TERM} = sub { $continue = 0 };

my $i = 0;
while ($continue) {
    open( FILE, ">>/home/kevin/t/daemon.log" );
    print FILE 'Line: ' . $i++ . "\n";
    close(FILE);
    sleep 1;
}