Commit 8ff7c87f authored by Franco Fichtner's avatar Franco Fichtner

cron: expose configure_cron() instead if invoking it multiple times #911

parent 5e97c86d
...@@ -2432,7 +2432,6 @@ function install_cron_job($command, $active=false, $minute="0", $hour="*", $mont ...@@ -2432,7 +2432,6 @@ function install_cron_job($command, $active=false, $minute="0", $hour="*", $mont
write_config(sprintf(gettext("Removed cron job for %s"), $command)); write_config(sprintf(gettext("Removed cron job for %s"), $command));
} }
} }
configure_cron();
} }
/** /**
......
...@@ -3122,6 +3122,7 @@ function upgrade_098_to_099() { ...@@ -3122,6 +3122,7 @@ function upgrade_098_to_099() {
function upgrade_099_to_100() function upgrade_099_to_100()
{ {
install_cron_job("newsyslog", false); install_cron_job("newsyslog", false);
configure_cron();
} }
function upgrade_100_to_101() function upgrade_100_to_101()
......
...@@ -444,11 +444,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -444,11 +444,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
write_config(); write_config();
// test / perform backup // test / perform backup
try { try {
$filesInBackup = backup_to_google_drive() ; $filesInBackup = backup_to_google_drive();
$cron_job = "/usr/local/opnsense/scripts/remote_backup.php"; $cron_job = "/usr/local/opnsense/scripts/remote_backup.php";
if (!cron_job_exists($cron_job)) { if (!cron_job_exists($cron_job)) {
// initial cron job install install_cron_job($cron_job, true, 0, 1);
install_cron_job($cron_job,true,0,1); configure_cron();
} }
} catch (Exception $e) { } catch (Exception $e) {
$filesInBackup = array() ; $filesInBackup = array() ;
......
...@@ -224,6 +224,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -224,6 +224,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
case 'monthly': case 'monthly':
default: default:
install_cron_job("/usr/local/etc/rc.update_bogons", true, "1", "3", "1", "*", "*"); install_cron_job("/usr/local/etc/rc.update_bogons", true, "1", "3", "1", "*", "*");
break;
} }
$config['system']['bogons']['interval'] = $pconfig['bogonsinterval']; $config['system']['bogons']['interval'] = $pconfig['bogonsinterval'];
} }
...@@ -237,6 +238,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -237,6 +238,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$savemsg = get_std_save_message(); $savemsg = get_std_save_message();
configure_cron();
filter_configure(); filter_configure();
} }
} }
......
...@@ -47,19 +47,19 @@ function install_backup_cron_jobs() ...@@ -47,19 +47,19 @@ function install_backup_cron_jobs()
if (!empty($config['system']['rrdbackup'])) { if (!empty($config['system']['rrdbackup'])) {
install_cron_job("/usr/local/etc/rc.backup_rrd", ($config['system']['rrdbackup'] > 0), $minute = "0", "*/{$config['system']['rrdbackup']}"); install_cron_job("/usr/local/etc/rc.backup_rrd", ($config['system']['rrdbackup'] > 0), $minute = "0", "*/{$config['system']['rrdbackup']}");
} else { } else {
install_cron_job("/usr/local/etc/rc.backup_rrd", false, $minute = "0", "*/{$config['system']['rrdbackup']}"); install_cron_job('/usr/local/etc/rc.backup_rrd', false);
} }
if (!empty($config['system']['dhcpbackup'])) { if (!empty($config['system']['dhcpbackup'])) {
install_cron_job("/usr/local/etc/rc.backup_dhcpleases", ($config['system']['dhcpbackup'] > 0), $minute = "0", "*/{$config['system']['dhcpbackup']}"); install_cron_job("/usr/local/etc/rc.backup_dhcpleases", ($config['system']['dhcpbackup'] > 0), $minute = "0", "*/{$config['system']['dhcpbackup']}");
} else { } else {
install_cron_job("/usr/local/etc/rc.backup_dhcpleases", false, $minute = "0", "*/{$config['system']['dhcpbackup']}"); install_cron_job('/usr/local/etc/rc.backup_dhcpleases', false);
} }
if (!empty($config['system']['netflowbackup'])) { if (!empty($config['system']['netflowbackup'])) {
install_cron_job("/usr/local/etc/rc.backup_netflow", ($config['system']['netflowbackup'] > 0), $minute = "0", "*/{$config['system']['netflowbackup']}"); install_cron_job("/usr/local/etc/rc.backup_netflow", ($config['system']['netflowbackup'] > 0), $minute = "0", "*/{$config['system']['netflowbackup']}");
} else { } else {
install_cron_job("/usr/local/etc/rc.backup_netflow", false, $minute = "0", "*/{$config['system']['netflowbackup']}"); install_cron_job('/usr/local/etc/rc.backup_netflow', false);
} }
} }
...@@ -236,6 +236,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -236,6 +236,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
system_resolvconf_generate(true); system_resolvconf_generate(true);
install_backup_cron_jobs(); install_backup_cron_jobs();
configure_cron();
filter_configure(); filter_configure();
activate_powerd(); activate_powerd();
load_crypto_module(); load_crypto_module();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment