summaryrefslogtreecommitdiff
path: root/scripts/keepalived
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2008-05-26 13:49:42 -0700
committerStig Thormodsrud <stig@vyatta.com>2008-05-26 13:49:42 -0700
commitb2b9964782c08fc586f1096e0641765a099f23b6 (patch)
tree680a8980e19e342ece7f9db28600278700bf09e4 /scripts/keepalived
parent0cf777376bdf5b347afffff8b5ffe56b269f6614 (diff)
downloadvyatta-cfg-system-b2b9964782c08fc586f1096e0641765a099f23b6.tar.gz
vyatta-cfg-system-b2b9964782c08fc586f1096e0641765a099f23b6.zip
Fix 2705: Add "clear vrrp process" command.
Diffstat (limited to 'scripts/keepalived')
-rwxr-xr-xscripts/keepalived/vyatta-keepalived.pl18
1 files changed, 16 insertions, 2 deletions
diff --git a/scripts/keepalived/vyatta-keepalived.pl b/scripts/keepalived/vyatta-keepalived.pl
index 7389534b..ac92ca8e 100755
--- a/scripts/keepalived/vyatta-keepalived.pl
+++ b/scripts/keepalived/vyatta-keepalived.pl
@@ -157,7 +157,7 @@ sub keepalived_get_values {
$output .= "\"$state_transition_script backup $intf $group $run_backup_script @vips\" \n";
$output .= "\tnotify_fault ";
$output .= "\"$state_transition_script fault $intf $group $run_fault_script @vips\" \n";
- $output .= "\}\n";
+ $output .= "\}\n\n";
}
return $output;
@@ -301,7 +301,9 @@ sub remove_from_changes {
sub vrrp_update_config {
my ($intf) = @_;
- my $output = '';
+ my $date = localtime();
+ my $output = "#\n# autogenerated by $0 on $date\n#\n\n";
+
my $config = new VyattaConfig;
$config->setLevel("interfaces ethernet");
@@ -391,6 +393,7 @@ if ($action eq "update") {
}
if ($vrrp_instances == 0) {
VyattaKeepalived::stop_daemon();
+ system("rm -f $conf_file");
}
}
@@ -405,6 +408,17 @@ if ($action eq "delete") {
exit 0;
}
+if ($action eq "clear") {
+ if (VyattaKeepalived::is_running()) {
+ print "Restarting VRRP...\n";
+ VyattaKeepalived::restart_daemon(VyattaKeepalived::get_conf_file());
+ } else {
+ print "Starting VRRP...\n";
+ VyattaKeepalived::start_daemon(VyattaKeepalived::get_conf_file());
+ }
+ exit 0;
+}
+
exit 0;
# end of file