From 4660b8e4d0e63d94c8eb05bea50fc07c5bd99f11 Mon Sep 17 00:00:00 2001 From: Gianni Ceccarelli Date: Mon, 15 Mar 2010 11:35:10 +0000 Subject: add locking mechanism we don't want to run twice --- hal-automounter.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)=@_; -- cgit v1.2.3