Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: 7cd199c6e3
Fetching contributors…

Cannot retrieve contributors at this time

executable file 29 lines (23 sloc) 0.584 kB
#!/usr/bin/perl -w
use strict;
die "usage: $0 lockfile command [arg ...]\n"
unless @ARGV >= 2;
my $lockfile = shift;
if (-e $lockfile) {
open FILE, "<$lockfile"
or die "unable to open file '$lockfile' for reading: $!\n";
my $pid = <FILE>;
if (kill 0, $pid) {
# only warn when the lock is more than an hour old
print "already running, pid $pid\n"
if (stat _)[9] < time() - 3600;
close FILE;
open FILE, ">$lockfile"
or die "unable to open file '$lockfile' for writing: $!\n";
print FILE $$;
close FILE;
system @ARGV;
unlink $lockfile;
Jump to Line
Something went wrong with that request. Please try again.