njcodewarrior has asked for the wisdom of the Perl Monks concerning the following question:
I've written a script that monitors a number of directories for changes in file modification times. It goes something like this:
#! /usr/bin/perl use strict; use warnings; my @directories = qw{/foo /bar}; my $directory; my @files; while ( 1 ) { FILECHECK: foreach $directory ( @directories ) { @files = glob("${directory}/*.log"); next FILECHECK unless @files; do some stuff here... } sleep 30; }
Obviously, the script runs indefinitely and I need to keep it running after I logout of my shell. With shell scripts, I typically use nohup and put the pid in the background (&), but I was wondering if there are any other ways to do it?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Persistent perl
by borisz (Canon) on Mar 24, 2006 at 22:05 UTC | |
Re: Persistent perl
by Argel (Prior) on Mar 25, 2006 at 00:31 UTC | |
by njcodewarrior (Pilgrim) on Mar 25, 2006 at 01:23 UTC | |
by Argel (Prior) on Mar 27, 2006 at 19:36 UTC | |
Re: Persistent perl
by CountZero (Bishop) on Mar 24, 2006 at 21:14 UTC | |
Re: Persistent perl
by roboticus (Chancellor) on Mar 24, 2006 at 22:05 UTC | |
Re: Persistent perl
by bowei_99 (Friar) on Mar 24, 2006 at 22:20 UTC | |
Re: Persistent perl
by asz (Pilgrim) on Mar 25, 2006 at 18:44 UTC | |
Re: Persistent perl
by davorg (Chancellor) on Mar 27, 2006 at 08:49 UTC |