From b2b9964782c08fc586f1096e0641765a099f23b6 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Mon, 26 May 2008 13:49:42 -0700 Subject: Fix 2705: Add "clear vrrp process" command. --- scripts/keepalived/vyatta-keepalived.pl | 18 ++++++++++++++++-- 1 file 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 -- cgit v1.2.3