summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 42ddb79)
raw | patch | inline | side by side (parent: 42ddb79)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 12 Feb 2008 12:55:57 +0000 (12:55 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 12 Feb 2008 12:55:57 +0000 (12:55 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8858 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/gosa-si-server | patch | blob | history | |
gosa-si/modules/DBsqlite.pm | patch | blob | history |
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index d0e45264bc448a52e25350194a0607b42a3a9589..584d349873ac0bb027c690548e3b754176d27493 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
daemon_log("$0 started!", 1);
# delete old DBsqlite lock files
-unlink('/tmp/gosa_si_lock*');
+#unlink('/tmp/gosa_si_lock*');
# connect to gosa-si job queue
my @job_col_names = ("id INTEGER", "timestamp", "status", "result", "headertag", "targettag", "xmlmessage", "macaddress");
index d5775bd26f0be7cd0d2e11c6fa6381391f433b01..029abcbf4105a3f231c4d0ac641f3009b08d49ac 100644 (file)
my $class = shift;
my $db_name = shift;
- my $lock='/tmp/gosa_si_lock';
- my $_lock = $db_name;
- $_lock =~ tr/\//_/;
- $lock.=$_lock;
+ my $lock = $db_name.".gosa_lock";
+ # delete existing lock - instance should be running only once
+ if(stat($lock)) {
+ unlink($lock);
+ }
my $self = {dbh=>undef,db_name=>undef,db_lock=>undef,db_lock_handle=>undef};
my $dbh = DBI->connect("dbi:SQLite:dbname=$db_name");
$self->{dbh} = $dbh;
my $lock = $self->{db_lock};
my $result=(-f $lock);
if($result) {
- #&main::daemon_log("(".((defined $funcname)?$funcname:"").") Lock (PID ".$$.") $lock gefunden", 8);
+ &main::daemon_log("(".((defined $funcname)?$funcname:"").") Lock (PID ".$$.") $lock found", 8);
usleep 100;
}
return $result;
sub create_lock : locked {
my $self=shift;
my $funcname=shift;
-# &main::daemon_log("(".((defined $funcname)?$funcname:"").") Erzeuge Lock (PID ".$$.") ".($self->{db_lock}),8);
+ &main::daemon_log("(".((defined $funcname)?$funcname:"").") Creating Lock (PID ".$$.") ".($self->{db_lock}),8);
my $lock = $self->{db_lock};
while( -f $lock ) {
- #print STDERR "(".((defined $funcname)?$funcname:"").") Lock (PID ".$$.") $lock gefunden\n";
+ &main::daemon_log("(".((defined $funcname)?$funcname:"").") Lock (PID ".$$.") $lock found",8);
sleep 1;
}
sub remove_lock : locked {
my $self=shift;
my $funcname=shift;
-# &main::daemon_log("(".((defined $funcname)?$funcname:"").") Entferne Lock (PID ".$$.") ".$self->{db_lock}, 8);
+ &main::daemon_log("(".((defined $funcname)?$funcname:"").") Removing Lock (PID ".$$.") ".$self->{db_lock}, 8);
close($self->{db_lock_handle});
unlink($self->{db_lock});
}