狼狼 发表于 2018-8-30 11:12:29

perl实现守护进程

  #!/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;
  }

页: [1]
查看完整版本: perl实现守护进程