Latest news
lock_unlock - creating and removing a lock file
At some point, every shell programmer must ensure that only one process executes at a given time or otherwise ensures a resource is locked.
Often, it's necessary to prevent more than one instance of the same (or related) programs from running at the same time. For example, you may have daily Oracle open backup, and hourly Oracle archive log backup. Both backups save archived logs and delete them. You do not want two instances to run at the same time, creating unpreditable results.
The idiom to do this in shell is to create a lock file or directory. Whatever instance sets the lock first is authorized to proceed. If another instance executes, but a lock exists, the first instance will either wait for the lock to lift or terminate. When the first instance completes execution, it then removes the lock file, so the next instance can run.
By Michael Wang at Unix Review.
[ Read more ]
![]()
Related items
- Review: The Complete Linux Shell Programming Training Course (7 March 2003)
Spotlight

Information security executives need to be strategic thinkers
Posted on 17 June 2013. | George Baker, the Director of Information Security at Exostar, talks about the challenges in working in a dynamic threat landscape, offers tips for aspiring infosec leaders, and more.

Large orgs in denial about own security breaches?
Posted on 14 June 2013. | Over two thirds (66%) of large organizations said they either had not experienced a security incident in the last 12-18 months or were unsure if they had.

Vulnerability scanning with PureCloud
Posted on 12 June 2013. | nCircle PureCloud is a cloud-based network security scanning product built upon the companies' vulnerability and risk management system IP360.

To hack back or not to hack back?
Posted on 12 June 2013. | If you think of cyberspace as a new resource for you and your organization, it makes sense to protect your part of it as best you can. But is it a good idea?

Reactions from the security community to the NSA spying scandal
Posted on 11 June 2013. | Read on for comments on this scandal that Help Net Security received from a variety of security professionals and analysts.
By subscribing to our early morning news update, you will receive a daily digest of the latest security news published on Help Net Security.
With over 500 issues so far, reading our newsletter every Monday morning will keep you up-to-date with security risks out there.







