in reply to Process Monitoring Madness

One problem is you are not matching lines that have commas in the dow

/^([\d*]+)\s+([\d*]+)\s+([\d*]+)\s+([\d*]+)\s+([\d\-*]+)\s+(.+*)/ add comma here ^

also this only removes one comma, you maybe want to add g

$dow =~ s/,//;
poj

Replies are listed 'Best First'.
Re^2: Process Monitoring Madness
by woland (Novice) on Oct 08, 2018 at 12:42 UTC
    Thanks poj - well spotted, I shall fix that now. Unfortunately today's problem manifests itself with the below crontab entries
    00 05 * * 0 /etc/init.d/smart_tse-ah2 start 00 22 * * 0 /etc/init.d/smart_tse-ah2 stop
    Which I believe the program should be ignoring :-/

      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...

        Hi Corion

        I have updated the OP with examples

        Thanks

        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

      Where in the program is %schedule declared ?

      poj