summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-11-23 15:58:19 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-11-23 16:42:09 -0800
commit01d4c9c6e8c5e7b20ff1bd7372417b086af8f301 (patch)
treee0e656664ef11cb6480e8b07f935c656ff01a0e1 /scripts
parente92206f19635c1a64afd0be16f5cda1a08b184c6 (diff)
downloadvyatta-cfg-system-01d4c9c6e8c5e7b20ff1bd7372417b086af8f301.tar.gz
vyatta-cfg-system-01d4c9c6e8c5e7b20ff1bd7372417b086af8f301.zip
Use unlink rather than system() to remove files in keepalive script
Faster to use perl to remove file than going out to shell.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/keepalived/vyatta-keepalived.pl10
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/keepalived/vyatta-keepalived.pl b/scripts/keepalived/vyatta-keepalived.pl
index 981bd5a8..ebb8307c 100755
--- a/scripts/keepalived/vyatta-keepalived.pl
+++ b/scripts/keepalived/vyatta-keepalived.pl
@@ -118,7 +118,7 @@ sub keepalived_get_values {
if ( $config->exists("disable") ) {
vrrp_log("$vrrp_instance disabled - skipping");
my $state_file = get_state_file( $intf, $group );
- system("rm -f $state_file");
+ unlink($state_file);
next;
}
my @vips = $config->returnValues("virtual-address");
@@ -337,7 +337,7 @@ sub remove_from_changes {
# we shouldn't get to this point, but try to handle it if we do
#
vrrp_log("unexpected remove_from_changes()");
- system("rm -f $changes_file");
+ unlink($changes_file);
return 0;
}
my @new_lines = ();
@@ -353,7 +353,7 @@ sub remove_from_changes {
if ( $num_changes > 0 ) {
vrrp_save_changes(@new_lines);
} else {
- system("rm -f $changes_file");
+ unlink($changes_file);
}
return $num_changes;
}
@@ -493,7 +493,7 @@ if ( $action eq "update" ) {
}
if ( $vrrp_instances == 0 ) {
stop_daemon();
- system("rm -f $conf_file");
+ unlink($conf_file);
}
if ( scalar(@errs) ) {
print join( "\n", @errs );
@@ -510,7 +510,7 @@ if ( $action eq "delete" ) {
}
vrrp_log("vrrp delete $vrrp_intf $vrrp_group");
my $state_file = get_state_file( $vrrp_intf, $vrrp_group );
- system("rm -f $state_file");
+ unlink($state_file);
exit 0;
}