Пример #1
0
<?php

/* Copyright 2015, Bergware International.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version 2,
 * as published by the Free Software Foundation.
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * Modified for Speedtest by dmacias, 2016
 */
require_once '/usr/local/emhttp/webGui/include/Wrappers.php';
if ($_POST['mode'] > 0) {
    $hour = isset($_POST['hour']) ? $_POST['hour'] : '*';
    $min = isset($_POST['min']) ? $_POST['min'] : '*';
    $dotm = isset($_POST['dotm']) ? $_POST['dotm'] : '*';
    $day = isset($_POST['day']) ? $_POST['day'] : '*';
    $cron = "# Generated speedtest schedule:\n{$min} {$hour} {$dotm} * {$day} /usr/sbin/speedtest-xml &> /dev/null\n\n";
} else {
    $cron = "";
}
parse_cron_cfg('dynamix', 'speedtest', $cron);
Пример #2
0
    case 'W2':
      $dotm = '*';
      $term = '[ $(date +%d) -ge 8 -a $(date +%d) -le 14 ] && ';
      break;
    case 'W3':
      $dotm = '*';
      $term = '[ $(date +%d) -ge 15 -a $(date +%d) -le 21 ] && ';
      break;
    case 'W4':
      $dotm = '*';
      $term = '[ $(date +%d) -ge 22 -a $(date +%d) -le 28 ] && ';
      break;
    case 'WL':
      $dotm = '*';
      $term = '[ $(date +%d -d +7days) -le 7 ] && ';
      break;
    default:
      $term = '';
    }
    $month = isset($_POST['month']) ? $_POST['month'] : '*';
    $day = isset($_POST['day']) ? $_POST['day'] : '*';
    $write = isset($_POST['write']) ? $_POST['write'] : '';
    $cron = "# Generated parity check schedule:\n$hour $dotm $month $day $term/root/mdcmd check $write &> /dev/null\n\n";
  }
  parse_cron_cfg("dynamix", "parity-check", $cron);
  unlink($memory);
} else {
  file_put_contents($memory, http_build_query($_POST));
  $save = false;
}
?>