diff options
author | Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com> | 2010-03-15 11:35:10 +0000 |
---|---|---|
committer | Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com> | 2010-03-15 11:35:10 +0000 |
commit | 4660b8e4d0e63d94c8eb05bea50fc07c5bd99f11 (patch) | |
tree | 9f720c951c7ddaed9338804352bf935e4f3f3977 /hal-automounter.pl | |
parent | initial import (diff) | |
download | hal-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-x | hal-automounter.pl | 5 |
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)=@_; |