summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2011-11-04 08:41:24 -0700
committerStephen Hemminger <shemminger@vyatta.com>2011-11-04 08:41:24 -0700
commit5d27f2ef302dc600ea737e9af4151041aa11a2e0 (patch)
treeacd5a44e7622f8fe91e6bebac3d473c59c67d485
parent6ad70d023b756467618665fd8640e4c63de4f6b8 (diff)
downloadvyatta-cfg-quagga-5d27f2ef302dc600ea737e9af4151041aa11a2e0.tar.gz
vyatta-cfg-quagga-5d27f2ef302dc600ea737e9af4151041aa11a2e0.zip
Cleanup dynamic DNS script
Remove reference to unused Switch (Bug 6888). Use mkdir perl function rather than calling system
-rwxr-xr-xscripts/dynamic-dns/vyatta-dynamic-dns.pl32
1 files changed, 11 insertions, 21 deletions
diff --git a/scripts/dynamic-dns/vyatta-dynamic-dns.pl b/scripts/dynamic-dns/vyatta-dynamic-dns.pl
index 232d260e..290b0543 100755
--- a/scripts/dynamic-dns/vyatta-dynamic-dns.pl
+++ b/scripts/dynamic-dns/vyatta-dynamic-dns.pl
@@ -30,7 +30,6 @@ use Getopt::Long;
use strict;
use warnings;
-use Switch;
my $ddclient_run_dir = '/var/run/ddclient';
my $ddclient_cache_dir = '/var/cache/ddclient';
@@ -55,13 +54,8 @@ if (defined $update_dynamicdns) {
dynamicdns_restart();
}
-if (defined $op_mode_update_dynamicdns) {
- dynamicdns_restart();
-}
-
-if (defined $stop_dynamicdns) {
- dynamicdns_stop();
-}
+dynamicdns_restart() if (defined $op_mode_update_dynamicdns);
+dynamicdns_stop() if (defined $stop_dynamicdns);
exit 0;
@@ -75,13 +69,10 @@ sub dynamicdns_restart {
}
sub dynamicdns_start {
-
- if(! -d $ddclient_run_dir ){
- system ("mkdir $ddclient_run_dir\;");
- }
- if(! -d $ddclient_cache_dir ){
- system ("mkdir $ddclient_cache_dir\;");
- }
+ mkdir $ddclient_run_dir
+ unless ( -d $ddclient_run_dir );
+ mkdir $ddclient_cache_dir
+ unless ( -d $ddclient_cache_dir );
system("/usr/sbin/ddclient -file $ddclient_config_dir/ddclient_$interface.conf >&/dev/null");
@@ -141,13 +132,12 @@ sub dynamicdns_get_values {
sub dynamicdns_write_file {
my ($config) = @_;
- if(! -d $ddclient_config_dir ){
- system ("mkdir $ddclient_config_dir\;");
- }
- open(my $fh, '>', "$ddclient_config_dir/ddclient_$interface.conf") || die "Couldn't open \"$ddclient_config_dir/ddclient_$interface.conf\" - $!";
+ mkdir $ddclient_config_dir
+ unless (-d $ddclient_config_dir );
+
+ open(my $fh, '>', "$ddclient_config_dir/ddclient_$interface.conf")
+ || die "Couldn't open \"$ddclient_config_dir/ddclient_$interface.conf\" - $!";
print $fh $config;
close $fh;
}
-
-# end of file