Perl lock file while updating

A lock object is created by calling the new method and passing two to four parameters in the following manner: Filename of the file upon which it is anticipated that a write will happen to.Locking will provide the most recent version (uncached) of this file upon a successful file lock. Lock type determines whether the lock will be blocking, non blocking, or shared.The syntax in the entry is [plugin_name].[fieldname].(warning|critical) [value].On the Munin page for the individual plugin, the fieldnames are listed as "Internal name" below the graphs.This article describes locking with common UNIX® tools.

Program based of concept of hard linking of files being atomic across NFS.

Sometimes there's a need to ensure only one copy of a script runs, i.e prevent two or more copies running simultaneously.

Imagine an important cronjob doing something very important, which will fail or corrupt data if two copies of the called program were to run at the same time.

This concept was mentioned in Mail:: Box:: Locker (which was originally presented in Mail:: Folder:: Maildir).

Some routine flow is taken from there -- particularly the idea of creating a random local file, hard linking a common file to the local file, and then checking the nlink status.

Locking occurs by creating a File:: NFSLock object.

You must have an account to comment. Please register or login here!