aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-09-03 12:53:37 +0200
committerdoktornotor <notordoktor@gmail.com>2015-09-03 12:53:37 +0200
commitc8068774a982930d7d31a7cce2cd11a1586a61b6 (patch)
treee94ef0ecc1bfb031c7a5a9f01681f7f8f19ae940
parent46d4da44f8da4cca4eee0e91382c8d2157d8afb1 (diff)
downloadpfsense-packages-c8068774a982930d7d31a7cce2cd11a1586a61b6.tar.gz
pfsense-packages-c8068774a982930d7d31a7cce2cd11a1586a61b6.tar.bz2
pfsense-packages-c8068774a982930d7d31a7cce2cd11a1586a61b6.zip
vnstat2 - use install_cron_job() instead of reimplementing it
-rw-r--r--config/vnstat2/vnstat2.inc47
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();