I have a problem with one of my scripts.
I have tried to lock a datafile but when when the script is executed there is no data saved on the specified files.
Can anyone help me out? i have checked my permisions and evrything is set ok.
here is part of the script
sub lock
{
flock (DATAFILE, 2);
seek (DATAFILE, 0, 2);
}
sub unlock
{
flock (DATAFILE, 8);
}
sub write_data
{
$i=1;
open(DATAFILE, ">>/data.txt");
open(LOG_OUT,">>/data.log");
print LOG_OUT "$response{$i}:";
$i++;
while ( $item{$i} gt " ")
{
print DATAFILE "$response{$i}:";
print LOG_OUT "$response{$i}:";
$i++;
}
print LOG_OUT "\n";
close(DATAFILE);
close(LOG_OUT);
}
lock(DATAFILE);
&write_data;
unlock(DATAFILE);
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!