When process gets killed you will be left with important.lock file still there, and no other processes would be able to work.

Also when using timeout with -l option, then someone else could break the lock: delete important.lock and create new important.lock file. So command "rm -f" of the first process could delete someone's lock.

I found this solution:

   lockfile -l90 important.lock || exit
   ln -f important.lock important.$$ || exit
trap "[[ \$(stat -c %i important.lock) == \$(stat -c %i important.$$) && -f important.$$ ]] && rm -f
important.lock important.$$" EXIT

   ...
   access_"important"_to_your_hearts_content
   ...


This way you will not remove important.lock created by someone else and you will see file important.$$ when lock was removed by force.





--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to