Passive check pipe problem

Matt Pounsett matt.pounsett at cira.ca
Thu Oct 2 17:09:23 CEST 2003


On Thu, 2 Oct 2003, Jim wrote:

> Should I implement some form of locking for the script that writes to the
> pipe? Or turn my script into a daemon that queues the messages with a
> suitable interval between?

If you have any two processes trying to frequently write to the same file,
you're going to get this sort of overwrite.  

Yes, you do want to implement some sort of file locking.  If the scripts doing
the writing are on the same machine as the command file (not accessed by NFS)
then a simple flock() call is enough.  If you're accessing the command file by
NFS, since NFS doesn't handle file locking well, you'll have to implement your
own file locking mechanism... such as creating and checking for a .LOCK file. 

-- 
Matt Pounsett                 CIRA - Canadian Internet Registration Authority
Technical Support Programmer                    350 Sparks Street, Suite 1110
matt.pounsett at cira.ca                                 Ottawa, Ontario, Canada
613.237.5335 ext. 231                                      http://www.cira.ca



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list