aboutsummaryrefslogtreecommitdiffstats
path: root/config/vnstat2/vnstat2.inc
diff options
context:
space:
mode:
authorPerry Mason <crazypark2@yahoo.dk>2010-07-01 19:38:58 +0200
committerPerry Mason <crazypark2@yahoo.dk>2010-07-01 19:38:58 +0200
commitb52165ef6d917d9400fa7d979a6770b6f1296946 (patch)
tree624b2427a75b73d99dab0bed9fcf63ec704a09cb /config/vnstat2/vnstat2.inc
parent5326d8d42e7bdafaec256c10236774f51d416bfc (diff)
downloadpfsense-packages-b52165ef6d917d9400fa7d979a6770b6f1296946.tar.gz
pfsense-packages-b52165ef6d917d9400fa7d979a6770b6f1296946.tar.bz2
pfsense-packages-b52165ef6d917d9400fa7d979a6770b6f1296946.zip
[vnstat2] on vnstat cron update use mount_rw
Diffstat (limited to 'config/vnstat2/vnstat2.inc')
-rw-r--r--config/vnstat2/vnstat2.inc22
1 files changed, 21 insertions, 1 deletions
diff --git a/config/vnstat2/vnstat2.inc b/config/vnstat2/vnstat2.inc
index a752f23f..8ba712b6 100644
--- a/config/vnstat2/vnstat2.inc
+++ b/config/vnstat2/vnstat2.inc
@@ -103,7 +103,7 @@ function vnstat_install_config() {
$cron_item['month'] = "*";
$cron_item['wday'] = "*";
$cron_item['who'] = "root";
- $cron_item['command'] = "/usr/local/bin/vnstat -u";
+ $cron_item['command'] = "/usr/local/pkg/vnstat.sh";
$config['cron']['item'][] = $cron_item;
// get system nic's and create a database for them
$array_of_real_nic_names = array();
@@ -125,6 +125,26 @@ 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);