diff options
author | Renato Botelho <renato@netgate.com> | 2015-09-08 08:25:22 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-09-08 08:25:22 -0300 |
commit | 46556938dc1664a6a9dd75ff99e78e192088c769 (patch) | |
tree | 7645aa2a21d34fecba26a07cf647357d4a88b9d3 /config | |
parent | 1e83c36e70c185e197143f323ec5bff91ce03ec5 (diff) | |
parent | 61cda8960b9cca712bfb6b84fa280f9eaee1c418 (diff) | |
download | pfsense-packages-46556938dc1664a6a9dd75ff99e78e192088c769.tar.gz pfsense-packages-46556938dc1664a6a9dd75ff99e78e192088c769.tar.bz2 pfsense-packages-46556938dc1664a6a9dd75ff99e78e192088c769.zip |
Merge pull request #1037 from doktornotor/patch-10
Diffstat (limited to 'config')
-rw-r--r-- | config/vnstat2/vnstat2.inc | 47 |
1 files changed, 2 insertions, 45 deletions
diff --git a/config/vnstat2/vnstat2.inc b/config/vnstat2/vnstat2.inc index 86a95346..b42bc0a9 100644 --- a/config/vnstat2/vnstat2.inc +++ b/config/vnstat2/vnstat2.inc @@ -30,56 +30,13 @@ require_once("util.inc"); function vnstat_install_deinstall() { - global $config; // Remove Vnstat package and files exec("/bin/rm -d -R /usr/local/www/vnstat2"); exec("/bin/rm -d -R /usr/local/www/vnstati"); exec("/bin/rm -d -R /usr/local/pkg/vnstat2"); exec("/bin/rm /usr/local/etc/vnstat.conf"); // Remove vnstat cron entry from config.xml - vnstat2_install_cron(false); -} - -function vnstat2_install_cron($vnstat_cron_value) { - global $config; - $is_installed = false; - if (!$config['cron']['item']) { - return; - } - $x=0; - foreach ($config['cron']['item'] as $item) { - if (strstr($item['command'], "/usr/local/pkg/vnstat2/vnstat2.sh")) { - $is_installed = true; - break; - } - $x++; - } - switch ($vnstat_cron_value) { - case true: - if (!$is_installed) { - $cron_item = array(); - $cron_item['minute'] = "*/1"; - $cron_item['hour'] = "*"; - $cron_item['mday'] = "*"; - $cron_item['month'] = "*"; - $cron_item['wday'] = "*"; - $cron_item['who'] = "root"; - $cron_item['command'] = "/usr/local/pkg/vnstat2/vnstat2.sh"; - $config['cron']['item'][] = $cron_item; - write_config(); - configure_cron(); - } - break; - case false: - if ($is_installed == true) { - if ($x > 0) { - unset($config['cron']['item'][$x]); - write_config(); - } - configure_cron(); - } - break; - } + install_cron_job("/usr/local/pkg/vnstat2/vnstat2.sh", false); } function change_vnstat_conf() { @@ -226,7 +183,7 @@ function vnstat_install_config() { } write_conf_f(); // Add cron job to config.xml - vnstat2_install_cron(true); + install_cron_job("/usr/local/pkg/vnstat2/vnstat2.sh", true, "*/1"); vnstat_create_nic_dbs(); write_config(); conf_mount_ro(); |