summaryrefslogtreecommitdiff
path: root/hal-automounter.pl
diff options
context:
space:
mode:
authorGianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>2010-03-15 11:35:10 +0000
committerGianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>2010-03-15 11:35:10 +0000
commit4660b8e4d0e63d94c8eb05bea50fc07c5bd99f11 (patch)
tree9f720c951c7ddaed9338804352bf935e4f3f3977 /hal-automounter.pl
parentinitial import (diff)
downloadhal-automounter-4660b8e4d0e63d94c8eb05bea50fc07c5bd99f11.tar.gz
hal-automounter-4660b8e4d0e63d94c8eb05bea50fc07c5bd99f11.tar.bz2
hal-automounter-4660b8e4d0e63d94c8eb05bea50fc07c5bd99f11.zip
add locking mechanism
we don't want to run twice
Diffstat (limited to 'hal-automounter.pl')
-rwxr-xr-xhal-automounter.pl5
1 files changed, 4 insertions, 1 deletions
diff --git a/hal-automounter.pl b/hal-automounter.pl
index 2ea4133..22e8f6f 100755
--- a/hal-automounter.pl
+++ b/hal-automounter.pl
@@ -2,12 +2,15 @@
use strict;
use warnings;
use lib '/home/dakkar/perl5/lib/perl5','/home/dakkar/perl5/lib/perl5/x86_64-linux-thread-multi';
-
+use IO::Socket::INET; # for locking
use Net::DBus;
use Net::DBus::Reactor;
use File::Temp;
use Cwd 'realpath';
+my $lock=IO::Socket::INET->new(LocalAddr=>'127.0.0.1',LocalPort=>9999,Type=>SOCK_STREAM,Listen=>1)
+ or die 'already running';
+
sub add_to_fstab {
my ($dev_path,$mount_point,$fs_type,$opts)=@_;