aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorPerry Mason <crazypark2@yahoo.dk>2010-07-01 11:35:11 +0200
committerPerry Mason <crazypark2@yahoo.dk>2010-07-01 11:35:11 +0200
commitb49162af1d502529826bc1992c8788988c7a36db (patch)
tree4ad14f8a589c64268762da28a7fdcbb8f08a87ef /config
parent264b0c520a171cd774368a52a7d83b8d089c6afa (diff)
downloadpfsense-packages-b49162af1d502529826bc1992c8788988c7a36db.tar.gz
pfsense-packages-b49162af1d502529826bc1992c8788988c7a36db.tar.bz2
pfsense-packages-b49162af1d502529826bc1992c8788988c7a36db.zip
[vnstat2] add file and dir exists check
Diffstat (limited to 'config')
-rw-r--r--config/vnstat2/vnstat2.inc7
1 files changed, 4 insertions, 3 deletions
diff --git a/config/vnstat2/vnstat2.inc b/config/vnstat2/vnstat2.inc
index 17dedd2d..a752f23f 100644
--- a/config/vnstat2/vnstat2.inc
+++ b/config/vnstat2/vnstat2.inc
@@ -26,6 +26,7 @@ function vnstat_install_deinstall() {
configure_cron();
conf_mount_ro();
}
+
function change_vnstat_conf(){
conf_mount_rw();
global $config;
@@ -74,7 +75,7 @@ EOF;
function create_vnstati_image() {
conf_mount_rw();
global $config;
- exec("[ ! -d dir ] && mkdir /usr/local/www/vnstati");
+ exec("[ ! -d /usr/local/www/vnstati ] && mkdir /usr/local/www/vnstati");
$iface = $_POST['vnstat_interface'];
$iface2 = $_POST['output_type'];
$ifaces_final = convert_friendly_interface_to_real_interface_name($iface);
@@ -87,13 +88,13 @@ function vnstat_install_config() {
global $config;
conf_mount_rw();
// Create vnstat database dir where it also will work for nanobsd
- exec("[ ! -d dir ] && mkdir /usr/local/pkg/vnstat");
+ exec("[ ! -d /usr/local/pkg/vnstat ] && mkdir /usr/local/pkg/vnstat");
// Unpack and move Vnstat frontend
exec("cd ..");
exec("tar -zxovf /usr/local/pkg/vnstat_php_frontend-1.4.1.tar.gz");
exec("mv vnstat_php_frontend-1.4.1 /usr/local/www/vnstat2");
// Move Vnstat config
- exec("mv /usr/local/pkg/vnstat.conf /usr/local/etc/vnstat.conf");
+ exec("[ ! -f /usr/local/etc/vnstat.conf ] && mv /usr/local/pkg/vnstat.conf /usr/local/etc/vnstat.conf");
// Add cron job to config.xml
$cron_item = array();
$cron_item['minute'] = "*/1";