[comp.sys.apollo] Checking for locked objects

philip@cel.cummins.com (Philip D. Pokorny) (06/24/91)

Doug Bank <dougb@mot.com> writes:
>  Is there any way to determine if a file is locked other than llkob.
>  I am trying to write a script that can tell if the file about to be
>  opened is already being used by someone else.  Without such a check, the
>  process just bombs.  

You might look into the llkr command in /systest/ssr_util.  It
is so handy that we have copied it to /com...  One user used it
to write a program that opens an edit window and waits for the
user to finish editing the file before exiting...

     /com/xdmc ce @'^1@'
     while ((^"/com/llkr ^1 >?/dev/null")) do
       /com/sleep 5
     enddo

The while loop runs llkr (list locker) against the file.  If
llkr generates any output on stdout (which it does if the file
is locked...) then the expression is true and the process
sleep's 5.  If not, the script exits.


Sincerely,
Philip Pokorny
Cummins Electronics
(That's where I work, not who tells me what to say...)
philip@cel.cummins.com


P.S.  Before SR10, llkr used to be able to tell you which
process had the lock.  That was real handy for finding out which
program to kill to unlock the file.  But now at SR10 you can
only tell which node has the file locked not which process... 
(Oh well...)


:)