in reply to Re^2: Process Monitoring Madness
in thread Process Monitoring Madness

Can you show us input that should/shouldn't match? Ideally for debugging, you hardcode that input, so we can test it without running crontab -l or the service status commands...

Personally, I've grown fond of Regexp::Debugger, which makes it very convenient to see where a regular expression deviates from the intended path...

Replies are listed 'Best First'.
Re^4: Process Monitoring Madness
by woland (Novice) on Oct 08, 2018 at 12:59 UTC
    Hi Corion

    I have updated the OP with examples

    Thanks

      Thanks! I had originally misread/misunderstood your code as I thought it also read the output of the /etc/init.d/* scripts, but it doesn't, so the output of them doesn't really matter.

        Maybe (maybe) there are weird different timezones between your cron job and the interactive jobs? Because I can't get spurious triggers and for me $today is 1 and $dow is 0. Maybe output these values (from cron) to see if they are different there?

Re^4: Process Monitoring Madness
by woland (Novice) on Oct 08, 2018 at 12:53 UTC
    Hi Corion

    The below is triggering alerts today even though date +%w == 1

    00 05 * * 0 /etc/init.d/smart_tse-ah2 start 00 22 * * 0 /etc/init.d/smart_tse-ah2 stop

    The regex itself appears fine as these false alerts are sporadic and the below crontab have so far caused no alerts today

    00 05 * * 1-5 /etc/init.d/tsefull start 00 22 * * 1-5 /etc/init.d/tsefull stop

    Thanks