Gossamer Forum
Home : Products : Links 2.0 : Installation -- Unix :

Problem with exclusive lock

Quote Reply
Problem with exclusive lock
I built my site using xitami server on my local machine and everything works fine, however when I put it on the Unix server all cgi`s work fine except when I try and make a change to any of the data files and I get this message back;

Error Message : unable to get exclusive lock on /cgi-bin/search/admin/data/categories.db.
Reason: 269244628

My categories.db had all the categories ready made on my machine and uploaded as is, after getting the above message (while trying to modify a category)when I checked the categories.db file it was wiped clean, same goes for links.db, and email.db when I add an email address, any ideas, thanks.
chmod

PS. If I make $db_use_flock = 0; in links.cfg everything works fine, server software is Apache 1.3.3 if that helps.

Further to this my ISP tells me that flock is not supported because of security reasons and I should use fcntl instead, any ideas on this appreciated, and also that LS is not supported and I should use grep instead, thanks.

[This message has been edited by chmod (edited July 26, 1999).]

[This message has been edited by chmod (edited July 26, 1999).]
Quote Reply
Re: Problem with exclusive lock In reply to
It means just what he is saying -- flock is not supported, and to use fnctl

flock does several different attempts to lock a file, finally calling fnctl.

The reason '0' works, is you are not locking the file.

use Fcntl;

fcntl (filehandle,function,arg)

Would call the file control 'function' (with the function specific 'arg') to use on the file or device opened with 'filehandle'

Quote Reply
Re: Problem with exclusive lock In reply to
Thanks Pugdog,
heres the flock code in my subscribe.cgi as an example, any help on how to place fcntl into the scripts and what to remove appreciated,

<CODE>
open (LIST, ">$list") or &cgierr ("Unable to open list: $list. Reason: $!");
if ($db_use_flock) { flock (LIST, 2) or &cgierr ("Unable to get exlusive lock! Reason: $!"); }
foreach (sort keys %{$users_r}) {
print LIST "$_$db_delim${$users_r}{$_}\n";
}
close LIST;
</CODE>

Also does fcntl make a good substitute for flock, thanks.

chmod

[This message has been edited by chmod (edited July 28, 1999).]
Quote Reply
Re: Problem with exclusive lock In reply to
I've been having random problems with flock, and really haven't found 'the' answer for fcntl which is the lower level c function.

This is probably a better discussion for the perl/cgi area.

Quote Reply
Re: Problem with exclusive lock In reply to
Yeah, its already in there with no replies, I guess its a nystery to most, I`ll look for more clues on this..
cheers Pugdog
chmod