diff options
Diffstat (limited to 'config/vnstat2')
-rw-r--r-- | config/vnstat2/vnstat2.inc | 24 | ||||
-rw-r--r-- | config/vnstat2/vnstat2.sh | 6 | ||||
-rw-r--r-- | config/vnstat2/vnstat2.xml | 5 |
3 files changed, 14 insertions, 21 deletions
diff --git a/config/vnstat2/vnstat2.inc b/config/vnstat2/vnstat2.inc index 8ba712b6..0d5f0291 100644 --- a/config/vnstat2/vnstat2.inc +++ b/config/vnstat2/vnstat2.inc @@ -7,8 +7,9 @@ function vnstat_install_deinstall() { exec("rm -d -R /usr/local/www/vnstat2"); exec("rm -d -R /usr/local/www/vnstati"); exec("rm /usr/local/pkg/vnstat_php_frontend.xml"); + exec("rm /usr/local/pkg/vnstat2.sh"); // Remove vnstat cron entry from config.xml - $task_key = '/usr/local/bin/vnstat -u'; + $task_key = '/usr/local/pkg/vnstat2.sh'; $x_name=''; $x=0; foreach($config['cron']['item'] as $item) { @@ -103,7 +104,7 @@ function vnstat_install_config() { $cron_item['month'] = "*"; $cron_item['wday'] = "*"; $cron_item['who'] = "root"; - $cron_item['command'] = "/usr/local/pkg/vnstat.sh"; + $cron_item['command'] = "/usr/local/pkg/vnstat2.sh"; $config['cron']['item'][] = $cron_item; // get system nic's and create a database for them $array_of_real_nic_names = array(); @@ -126,25 +127,6 @@ function vnstat_install_config() { exec("/usr/local/bin/vnstat -u -i ". $result2); } -// ************ Write new vnstat.sh ***************** - - $vnstat_bash_file = <<<EOF -#!/bin/sh - -/etc/rc.conf_mount_rw -/usr/local/bin/vnstat -u -sleep 0.2 -/etc/rc.conf_mount_ro -EOF; - - $hf3 = fopen("/usr/local/pkg/vnstat.sh","w"); - if(!$hf3) { - log_error("could not open /usr/local/pkg/vnstat.sh for writing"); - exit; - } - fwrite($hf3, $vnstat_bash_file); - fclose($hf3) - // Find information to be writing in config.php // $iface_list_array_items exec("ls /usr/local/pkg/vnstat/ | grep -v '\.'", $vnstat_nic_in); diff --git a/config/vnstat2/vnstat2.sh b/config/vnstat2/vnstat2.sh new file mode 100644 index 00000000..05fb1136 --- /dev/null +++ b/config/vnstat2/vnstat2.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +/etc/rc.conf_mount_rw +/usr/local/bin/vnstat -u +sleep 0.2 +/etc/rc.conf_mount_ro diff --git a/config/vnstat2/vnstat2.xml b/config/vnstat2/vnstat2.xml index e855aff0..8b3e4b51 100644 --- a/config/vnstat2/vnstat2.xml +++ b/config/vnstat2/vnstat2.xml @@ -52,6 +52,11 @@ <chmod>0644</chmod> <item>http://www.pfsense.com/packages/config/vnstat2/vnstati.xml</item> </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/vnstat2/vnstat2.sh</item> + </additional_files_needed> <fields> <field> <description>Change rotate day of the month (by default set to 1)</description> |