Calling lockf from the shell line works fine, but in the script, it fails
Everything seems to work fine when I do the following...
Code:
% lockf -t 30 /usr/party/log/party.log sleep 30
Now when I add it to a perl script like in the following
Code:
#!/usr/bin/perl
use warnings;
my $value;
while (True)
{
if(`w | grep cd | grep party`) {
`lockf -t 30 /usr/party/log/party.log sleep 30`;
sleep(30);
}
else {
print "not logged in\n";
}
sleep(1);
}
It doesn't work even though lockf shows up on my ps table.
Quote:
cdalten 50123 0.0 0.2 3764 2580 pl IN 12:51PM 0:00.32 -zsh (zsh)
cdalten 52997 0.0 0.2 2796 2276 pl SN+ 1:30PM 0:00.05 /usr/bin/perl ./scan.pl (perl5.8.8)
cdalten 53078 0.0 0.1 1256 596 pl SN+ 1:31PM 0:00.00 lockf -t 30 /usr/party/log/party.log sleep 30
cdalten 53079 0.0 0.0 1256 432 pl SN+ 1:31PM 0:00.00 sleep 30
I don't get why it fails when I run it in a perl script.