diff options
-rw-r--r-- | packages/carp_sync_client.php | 21 |
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 &"); } } } |