Open up a TCP socket, and have the programs ping each other back and forth. Typically the secondary will ping the primary. If the primary doesn't respond, then the secondary should take over.
Actually, couldn't you write a different script that does the pinging, and then fires up the needed process on one system or the other?

They'd each be identical. If the process was running, no new action. If the process isn't running, ping the identical script on the other machine. If the other machine's not there, start the process on the current machine.

If they were both running at once, one had to start, and if that one started, then the process is running. Each freezes current working data in a known location, and if the process fails for one, then it tells the other to start its process up with the working data. If the process gets no ping and no process is running, it looks in the known place for the last set of working data and uses that. If there's no last set, it just starts the process.

Just my $0.02...

-----------------------
You are what you think.


In reply to Re: Re: CGI script on cluster server by chaoticset
in thread CGI script on cluster server by qadwjoh

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.