From fd797b4367184ab1b4408a8db30aa7fec92107ce Mon Sep 17 00:00:00 2001 From: Andrew Z Date: Fri, 11 Jan 2019 23:27:27 -0500 Subject: [PATCH] Fix custom parity check schedule --- plugins/dynamix/include/update.parity.php | 29 ++++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/plugins/dynamix/include/update.parity.php b/plugins/dynamix/include/update.parity.php index 345ea7112..be420a4b9 100644 --- a/plugins/dynamix/include/update.parity.php +++ b/plugins/dynamix/include/update.parity.php @@ -25,12 +25,29 @@ if (isset($_POST['#apply'])) { $write = $_POST['write'] ?? ''; $term = ''; switch ($dotm) { - case '28-31': $term = '[[ $(date +%e -d +1day) -eq 1 ]] && '; break; - case 'W1' : $dotm = '1-7'; break; - case 'W2' : $dotm = '8-14'; break; - case 'W3' : $dotm = '15-21'; break; - case 'W4' : $dotm = '22-28'; break; - case 'WL' : $dotm = '22-31'; $term = '[[ $(date +%e -d +7days) -le 7 ]] && '; break; + case '28-31': + $term = '[[ $(date +%e -d +1day) -eq 1 ]] && '; + break; + case 'W1' : + $dotm = '*'; + $term = '[[ $(date +%e) -le 7 ]] && '; + break; + case 'W2' : + $dotm = '*'; + $term = '[[ $(date +%e -d -7days) -le 7 ]] && '; + break; + case 'W3' : + $dotm = '*'; + $term = '[[ $(date +%e -d -14days) -le 7 ]] && '; + break; + case 'W4' : + $dotm = '*'; + $term = '[[ $(date +%e -d -21days) -le 7 ]] && '; + break; + case 'WL' : + $dotm = '*'; + $term = '[[ $(date +%e -d +7days) -le 7 ]] && '; + break; } $cron = "# Generated parity check schedule:\n$time $dotm $month $day $term/usr/local/sbin/mdcmd check $write &> /dev/null || :\n\n"; }