aboutsummaryrefslogtreecommitdiffstats
path: root/packages/carp_sync_client.php
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-03-24 01:14:55 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-03-24 01:14:55 +0000
commit25554c03fc53efb4e6a84f89b0cf8ca62c3f8d2a (patch)
tree8ec721f83ee1a3610031786242d7228bfbb6d115 /packages/carp_sync_client.php
parentb2988d41441deadaed2e3c2fdc2dfd1fa6a17791 (diff)
downloadpfsense-packages-25554c03fc53efb4e6a84f89b0cf8ca62c3f8d2a.tar.gz
pfsense-packages-25554c03fc53efb4e6a84f89b0cf8ca62c3f8d2a.tar.bz2
pfsense-packages-25554c03fc53efb4e6a84f89b0cf8ca62c3f8d2a.zip
Speed up syncing to other hosts by doing it in the background.
Diffstat (limited to 'packages/carp_sync_client.php')
-rw-r--r--packages/carp_sync_client.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/packages/carp_sync_client.php b/packages/carp_sync_client.php
index 723d92df..e5bd1cdf 100644
--- a/packages/carp_sync_client.php
+++ b/packages/carp_sync_client.php
@@ -38,6 +38,7 @@ if($already_processed != 1)
$files_to_copy = "";
if($carp['synchronizerules'] <> "" and is_array($config['filter'])) {
$current_rules_section = backup_config_section("filter");
+ $current_rules_section = str_replace("<?xml version=\"1.0\"?>", "", $current_rules_section);
/* generate firewall rules xml */
$fout = fopen("{$g['tmp_path']}/filter_section.txt","w");
fwrite($fout, $current_rules_section);
@@ -46,6 +47,7 @@ if($already_processed != 1)
}
if($carp['synchronizenat'] <> "" and is_array($config['nat'])) {
$current_nat_section = backup_config_section("nat");
+ $current_nat_section = str_replace("<?xml version=\"1.0\"?>", "", $current_nat_section);
/* generate nat rules xml */
$fout = fopen("{$g['tmp_path']}/nat_section.txt","w");
fwrite($fout, $current_nat_section);
@@ -54,6 +56,7 @@ if($already_processed != 1)
}
if($carp['synchronizealiases'] <> "" and is_array($config['aliases'])) {
$current_aliases_section = backup_config_section("aliases");
+ $current_aliases_section = str_replace("<?xml version=\"1.0\"?>", "", $current_aliases_section);
/* generate aliases xml */
$fout = fopen("{$g['tmp_path']}/aliases_section.txt","w");
fwrite($fout, $current_aliases_section);
@@ -62,6 +65,7 @@ if($already_processed != 1)
}
if($carp['synchronizetrafficshaper'] <> "" and is_array($config['shaper'])) {
$current_trafficshaper_section = backup_config_section("shaper");
+ $current_trafficshaper_section = str_replace("<?xml version=\"1.0\"?>", "", $current_trafficshaper_section);
/* generate aliases xml */
$fout = fopen("{$g['tmp_path']}/shaper_section.txt","w");
fwrite($fout, $current_trafficshaper_section);
@@ -69,16 +73,15 @@ if($already_processed != 1)
$files_to_copy .= " {$g['tmp_path']}/shaper_section.txt";
}
/* copy configuration to remote host */
- mwexec("/usr/bin/scp {$files_to_copy} root@{$synchronizetoip}:/tmp/");
-
- /* remove extracted config files */
- unlink_if_exists("{$g['tmp_path']}/filter_section.txt");
- unlink_if_exists("{$g['tmp_path']}/nat_section.txt");
- unlink_if_exists("{$g['tmp_path']}/aliases_section.txt");
- unlink_if_exists("{$g['tmp_path']}/shaper_section.txt");
-
+ /*
+ mwexec("/usr/bin/scp {$files_to_copy} root@{$synchronizetoip}:/tmp/");
+ unlink_if_exists("{$g['tmp_path']}/filter_section.txt");
+ unlink_if_exists("{$g['tmp_path']}/nat_section.txt");
+ unlink_if_exists("{$g['tmp_path']}/aliases_section.txt");
+ unlink_if_exists("{$g['tmp_path']}/shaper_section.txt");
+ */
/* execute configuration on remote host */
- mwexec("/usr/bin/ssh {$synchronizetoip} /usr/local/pkg/carp_sync_server.php &");
+ mwexec("/usr/bin/scp {$files_to_copy} root@{$synchronizetoip}:/tmp/ && /usr/bin/ssh {$synchronizetoip} /usr/local/pkg/carp_sync_server.php &");
}
}
}