perl实现守护进程

时间:2015-08-04 23:15:43   收藏:0   阅读:390

#!/usr/bin/perl
use strict;
use File::Slurp;
use Proc::Fork;
my $code=read_file(‘./dig.pl‘);
while(1){
   run_fork{
       child{
       eval($code);
       if($@){
           ERROR  $@;
        }
       exit;
    }
    parent{
       my $childPid=shift;
       waitpid $childPid,0;
    }
    };    
    sleep 1800;
}

本文出自 “技术屌丝” 博客,谢绝转载!

原文:http://yeqing.blog.51cto.com/3159086/1681656

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!