in reply to Perl daemon ?
to make a simple daemon just de-attach the called script with this peace of code:
and now when you demonize your script then you can with a simple while loop schedule all scripts set in some dir like:die "Cannot continue :$!" unless(defined(my $kid = fork())); unless ($kid){ system("my scheduler"); exit; }
and that is more-or-less what you need to set up your first crone-like application. (just remember to set the absolute path with readdir -> it just captures the names of scripts in opened folder). of course don't forget to chmod to 555 to all files in defined dir (either through perl or manually).in my scheduler : ----------------- while(1){ # predefined diractory opendir(DIR,"some dir") || die "$!"; foreach my $sc (readdir(DIR)){ next if ($sc=~/\./g); system($sc); } sleep 3600; # of whatever time you need }
good luck !
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl daemon ?
by newbie01.perl (Sexton) on Nov 23, 2009 at 10:26 UTC |