aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2014-08-19 16:00:52 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2014-08-19 16:00:52 +0300
commitfd4ddf1cf5b7d5f67f0aa5d676e5f90158fb57e7 (patch)
treed842e1485a9cca2441a652dc109d4c61702909c0
parenta192ca696d9531f3f80223cbe31ec361583b921c (diff)
downloaddnstools-fd4ddf1cf5b7d5f67f0aa5d676e5f90158fb57e7.tar.gz
dnstools-fd4ddf1cf5b7d5f67f0aa5d676e5f90158fb57e7.tar.bz2
Fixes in vhostcname
* vhostcname (nssetup): Remove. Use update_cnames_from_hash instead. (main): Call update_cnames_from_hash even if no cnames were gathered, so that it can generate the proper delete requests. Call nscleanup only if one of '*start' commands was given.
-rwxr-xr-xvhostcname/vhostcname18
1 files changed, 4 insertions, 14 deletions
diff --git a/vhostcname/vhostcname b/vhostcname/vhostcname
index d8f76ed..eddb9fd 100755
--- a/vhostcname/vhostcname
+++ b/vhostcname/vhostcname
@@ -1,4 +1,4 @@
-#! /usr/bin/perl
+#!/usr/bin/perl
# Copyright (C) 2014 Sergey Poznyakoff <gray@gnu.org>
#
# This program is free software; you can redistribute it and/or modify
@@ -233,13 +233,6 @@ sub update_cnames_from_dir($) {
update_cnames_from_hash(get_cnames(shift));
}
-sub nssetup {
- if (-f $cnamelist) {
- unlink($cnamelist) or abend(1, "can't unlink $cnamelist: $!");
- }
- &update_cnames_from_hash;
-}
-
sub nscleanup {
print STDERR "$script: Removing DNS CNAME records\n" if ($debug);
@@ -346,14 +339,11 @@ if ($#ARGV == -1) {
} elsif ($#ARGV != 0) {
abend(3, "too many arguments");
} elsif ($ARGV[0] =~ /^start|restart|force-restart|reload$/) {
- nscleanup unless ($ARGV[0] eq "start");
+ nscleanup if ($ARGV[0] =~ /start$/);
my %cnames = get_cnames(-d "$confdir/sites-enabled" ?
"$confdir/sites-enabled" : $confdir);
- if (keys(%cnames) > 0) {
- nssetup(%cnames);
- } elsif ($debug) {
- print STDERR "$script: no cnames defined\n";
- }
+ update_cnames_from_hash(%cnames);
+ print STDERR "$script: no cnames defined\n" unless (keys(%cnames) > 0);
} elsif ($ARGV[0] eq "stop") {
nscleanup;
} elsif ($ARGV[0] eq "status") {

Return to:

Send suggestions and report system problems to the System administrator.