summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2007-12-18 17:49:40 -0800
committerStig Thormodsrud <stig@vyatta.com>2007-12-18 17:49:40 -0800
commita1d251d60a96aacc7e2523ea0bd8d599279dbdc8 (patch)
tree81d7bce2de18736c47a04292913cae76ec00d278 /scripts
parentc30fc4752c878c12255101aa928c64f7a3511020 (diff)
downloadvyatta-cfg-quagga-a1d251d60a96aacc7e2523ea0bd8d599279dbdc8.tar.gz
vyatta-cfg-quagga-a1d251d60a96aacc7e2523ea0bd8d599279dbdc8.zip
Fix new vrrp group show command.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/keepalived/VyattaKeepalived.pm9
-rwxr-xr-xscripts/keepalived/vyatta-show-vrrp.pl10
2 files changed, 14 insertions, 5 deletions
diff --git a/scripts/keepalived/VyattaKeepalived.pm b/scripts/keepalived/VyattaKeepalived.pm
index e0e84af3..13512b42 100755
--- a/scripts/keepalived/VyattaKeepalived.pm
+++ b/scripts/keepalived/VyattaKeepalived.pm
@@ -115,11 +115,16 @@ sub get_master_file {
}
sub get_state_files {
- my $intf = shift;
+ my ($intf, $group) = @_;
# todo: fix sorting for ethX > 9
my @state_files;
- open(my $LS, "ls $state_dir |grep '^vrrpd_$intf.*\.state\$' | sort |");
+ my $LS;
+ if ($group eq "all") {
+ open($LS,"ls $state_dir |grep '^vrrpd_$intf.*\.state\$' | sort |");
+ } else {
+ open($LS,"ls $state_dir |grep '^vrrpd_$intf.\_$group\.state\$' | sort |");
+ }
@state_files = <$LS>;
close($LS);
foreach my $i (0 .. $#state_files) {
diff --git a/scripts/keepalived/vyatta-show-vrrp.pl b/scripts/keepalived/vyatta-show-vrrp.pl
index 934808f6..9228eeeb 100755
--- a/scripts/keepalived/vyatta-show-vrrp.pl
+++ b/scripts/keepalived/vyatta-show-vrrp.pl
@@ -147,17 +147,21 @@ sub vrrp_show {
#
# main
#
-my $intf = "eth";
-if ($#ARGV > -1) {
+my $intf = "eth";
+my $group = "all";
+if ($#ARGV == 0) {
$intf = $ARGV[0];
}
+if ($#ARGV == 1) {
+ $group = $ARGV[1];
+}
if (!VyattaKeepalived::is_running()) {
print "VRRP isn't running\n";
exit 1;
}
-my @state_files = VyattaKeepalived::get_state_files($intf);
+my @state_files = VyattaKeepalived::get_state_files($intf, $group);
foreach my $state_file (@state_files) {
vrrp_show($state_file);
}