Up until today, I was a happy user of Proc::PID::File. But this morning, one of my servers ran out of disk space on /var, and that module wasn't able to write out its pidfile anymore. The result was a process table full of long-running cron jobs, bringing the machine down due to excessive swapping.

Is there a better alternative for Proc::PID::File that will gracefully handle reboots *and* running out of disk space?

I want to be certain only one job runs at a time, even if I'm not managing my disk space properly :)

Update: obviously, a code snippet is in order (sorry, grep):

#!/usr/bin/perl use Proc::PID::File; die "Already running!" if Proc::PID::File->running; # rest of script follows

Another update: Just so I don't come off like a complete idiot, here's what happened to this machine. It has a replicating MySQL slave running, and somewhere during the night, there was an error with it. The result was that the slave kept recording the relay-bin logs, but didn't process them. Since our data changes a lot, the slave quickly filled up the disk. I don't think monitoring tools would have avoided me waking up to a thrashing box.

In reply to Whoa! looking for a better pidfile module by rhesa

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.