summaryrefslogtreecommitdiff
path: root/scripts/dynamic-dns
diff options
context:
space:
mode:
authorMohit Mehta <mohit.mehta@vyatta.com>2008-09-10 18:17:44 -0700
committerMohit Mehta <mohit.mehta@vyatta.com>2008-09-10 18:17:44 -0700
commitc3ff271bc4212bb307e3735de430cfabd126ef70 (patch)
tree9adf681ce4cf90f0ebb64fea90548370546527ee /scripts/dynamic-dns
parenta3ab44f29b9a02e9167fef1e13fa21987a9430ae (diff)
downloadvyatta-cfg-system-c3ff271bc4212bb307e3735de430cfabd126ef70.tar.gz
vyatta-cfg-system-c3ff271bc4212bb307e3735de430cfabd126ef70.zip
- remove ddclient cache before restarting
- modify script to run op-mode update ddns
Diffstat (limited to 'scripts/dynamic-dns')
-rw-r--r--scripts/dynamic-dns/vyatta-dynamic-dns.pl16
1 files changed, 13 insertions, 3 deletions
diff --git a/scripts/dynamic-dns/vyatta-dynamic-dns.pl b/scripts/dynamic-dns/vyatta-dynamic-dns.pl
index a720c12f..89e39626 100644
--- a/scripts/dynamic-dns/vyatta-dynamic-dns.pl
+++ b/scripts/dynamic-dns/vyatta-dynamic-dns.pl
@@ -40,10 +40,11 @@ my $ddclient_config_dir = '/etc/ddclient';
# main
#
-my ($update_dynamicdns, $stop_dynamicdns, $interface);
+my ($update_dynamicdns, $op_mode_update_dynamicdns, $stop_dynamicdns, $interface);
GetOptions("update-dynamicdns!" => \$update_dynamicdns,
"stop-dynamicdns!" => \$stop_dynamicdns,
+ "op-mode-update-dynamicdns!" => \$op_mode_update_dynamicdns,
"interface=s" => \$interface);
if (defined $update_dynamicdns) {
@@ -54,6 +55,10 @@ if (defined $update_dynamicdns) {
dynamicdns_restart();
}
+if (defined $op_mode_update_dynamicdns) {
+ dynamicdns_restart();
+}
+
if (defined $stop_dynamicdns) {
dynamicdns_stop();
}
@@ -65,6 +70,11 @@ exit 0;
#
sub dynamicdns_restart {
+ dynamicdns_stop();
+ dynamicdns_start();
+}
+
+sub dynamicdns_start {
if(! -d $ddclient_run_dir ){
system ("mkdir $ddclient_run_dir\;");
@@ -73,13 +83,13 @@ sub dynamicdns_restart {
system ("mkdir $ddclient_cache_dir\;");
}
- system("kill -9 `cat $ddclient_run_dir/ddclient_$interface.pid 2>/dev/null` >&/dev/null");
system("/usr/sbin/ddclient -file $ddclient_config_dir/ddclient_$interface.conf >&/dev/null");
}
sub dynamicdns_stop {
system("kill -9 `cat $ddclient_run_dir/ddclient_$interface.pid 2>/dev/null` >&/dev/null");
+ system("rm -f $ddclient_cache_dir/ddclient_$interface.cache >&/dev/null");
}
sub dynamicdns_get_constants {
@@ -128,7 +138,7 @@ sub dynamicdns_get_values {
sub dynamicdns_write_file {
my ($config) = @_;
-
+
if(! -d $ddclient_config_dir ){
system ("mkdir $ddclient_config_dir\;");
}