PhiloLock

NOTE

As of Philo 3v2, this is standard. Use these instructions to alter a Philo3v1 install.

The Problem

Running more than one philoload command at the same time doesn't work. We need a locking mechanism to prevent this from happening. The original realease of Philologic 3 didn't have this mechanism.

The Solution

Add this cocde to philoload:

# Check to see if the lock file exists.... if so, die

# Otherwise, create it.

if (-e $PHILOTMP . "/philo.lock") {

die "The lockfile " . $PHILOTMP . "/philo.lock has been detected. Philoload might already be running, and we can only have one version running at a time. Examine \

the lock file. It should contain the PID of the philoload process that created it. If that process isn't running anymore, it probably exited abnormally and you can de\

lete the lock file and re-run your philoload command.";

} else {

open (LOCK, ">$PHILOTMP/philo.lock");

print LOCK $$ . "\n";

close LOCK;

}

Then later:

&genfilelist;

&genloadcfg;

&makemess;

# Remove the lock file

$res = `rm $PHILOTMP/philo.lock`;

This will check to see if the lockfile exists. If it does, it dies with a warning. If it doesn't, it will print out the philoload PID to the lock file in the $PHILOTMP directory and remove it after processing is done.