geektron has asked for the wisdom of the Perl Monks concerning the following question:
Thing is, my cron output sends me the warn and die messages, but the script is *still* running.if (-e "/tmp/.updLock") { open(FILE, "/tmp/.updLock"); my $line = <FILE>; close(FILE); chomp $line; + + warn "PROCESS $line already running \n\n"; + + my @ps = `ps -p $line`; my $count = @ps; if ($count == 1) { # IT's FAKING IT!! + + warn "PROCESS $line not actually running. Lockfile deleted. \n\ +n"; unlink("/tmp/.updLock"); } + + # we're still updating from last time + + die "$0 still running\n\n" if $count > 1; } else { open(FILE, "> /tmp/.upLock"); print FILE $$; close(FILE); }
I do have an END block, but all is does is: $dbh->disconnect() if defined( $dbh );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: die; not really dying
by UnderMine (Friar) on Mar 05, 2004 at 17:17 UTC | |
by geektron (Curate) on Mar 05, 2004 at 17:45 UTC | |
|
Re: die; not really dying
by bluto (Curate) on Mar 05, 2004 at 17:40 UTC |