I agree with ++1nickt's post, that you need to find the root cause of the crash. While describing my first potential work-around (next paragraph), I also found a likely candidate for the root cause for you (which follows in this paragraph). When you create a new task in the task manager, there are lots of default settings you might not even notice. On the task's properties, there is a Settings tab. On that tab, there is a checkbox that says "☑ Stop the task if it runs longer than: 3 days". I would make sure that box is not checked, otherwise Windows will stop the task after 3 days. Then go to the Triggers tab, and for every trigger you have defined, check the Advanced section and make sure "☐ Stop the task if it runs longer than: 3 days" is unchecked as well (though there it appears to be unchecked by default). I don't know why they have that in two separate spots, but there you are.

As my first idea for a workaround, after making sure the 3 days is disabled on both tabs, I would go to that Settings tab for each of your three jobs, and make sure it's set at "If the task is already running, then the following rule applies: Do not start a new instance": this will mean that how ever often you trigger the job, it will only run one instance. I would then go to the Triggers tab, and set it up to run On a schedule, "☑ Daily", Advanced = "☑ Repeat task every: N minutes for a duration of 1 day", where you choose the number of minutes or hours that would be reasonable for your task. If the world will end, or you'll lose your job, if the job isn't running for an entire hour, I might set it to 30 minutes, just to give yourself some margin. If the bomb will go off if your task stops running for more than 5 minutes, you should set it for 5 minutes or less, and might want to pick a different line of work figure out some other backup strategy, just in case.

Alternately, you could make one "launcher" script, which runs quickly every 5 minutes, but doesn't stay running. Each of your jobs could have some sort of "I'm alive" indicator (like touching a temporary indicator-file (different file each job) once every couple of minutes while they're running, or similar), which your "launcher" script could check for; if that indicator file for one or more of your jobs gets too old, then the "launcher" should run a new instance of that job in the background. Or, instead of an indicator-file, you could have the launcher script use the Win32 API to search for a windows task that matches each of your jobs, and launch a new instance if it cannot find it.

That's personally the order I would try things, if I were in this situation. But I really think that one or both of the "☐ Stop the task if it runs longer than: 3 days" checkboxes would be the likely first candidates.


In reply to Re: Run perl job 24 by 7 by pryrt
in thread Run perl job 24 by 7 by sunlifePunit

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.