use File::Temp qw(tmpnam);
use Filesys::Df;
-use LockFile::Simple qw(lock unlock);
+use LockFile::Simple;
my $tiledir = shift @ARGV;
-lock($tiledir) || exit 0;
+my $lockmgr = LockFile::Simple->make(-autoclean => 1, -max => 1, -hold => 0, -warn => 0);
+
+$lockmgr->lock("${tiledir}/cleanup") || exit 0;
my $tempfile = tmpnam();
unlink($tempfile);
-unlock($tiledir);
+$lockmgr->unlock("${tiledir}/cleanup");
exit 0;