rework thisfilename, add parent option, in advance of vpanel scripts
This commit is contained in:
parent
b7cd35384c
commit
45d0a9ed5c
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
||||||
|
|
||||||
help()
|
help()
|
||||||
{
|
{
|
||||||
thisfilename=$(basename -- "$0")
|
|
||||||
echo "$thisfilename"
|
|
||||||
echo "Set/update PTR Record."
|
echo "Set/update PTR Record."
|
||||||
echo ""
|
echo ""
|
||||||
echo "usage: $thisfilename -i <ip> [-r <record>] [-l <ttl>] [-s <status>] [-c <comment>] [-a <account>] [-h]"
|
echo "usage: $thisfilename -i <ip> [-r <record>] [-l <ttl>] [-s <status>] [-c <comment>] [-a <account>] [-h]"
|
||||||
|
|
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
||||||
|
|
||||||
help()
|
help()
|
||||||
{
|
{
|
||||||
thisfilename=$(basename -- "$0")
|
|
||||||
echo "$thisfilename"
|
|
||||||
echo "Delete Resource Record set in zone."
|
echo "Delete Resource Record set in zone."
|
||||||
echo ""
|
echo ""
|
||||||
echo "usage: $thisfilename -z <zone> -n <name> -t <type> [-h]"
|
echo "usage: $thisfilename -z <zone> -n <name> -t <type> [-h]"
|
||||||
|
|
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
||||||
|
|
||||||
help()
|
help()
|
||||||
{
|
{
|
||||||
thisfilename=$(basename -- "$0")
|
|
||||||
echo "$thisfilename"
|
|
||||||
echo "Replace Resource Record set in zone."
|
echo "Replace Resource Record set in zone."
|
||||||
echo ""
|
echo ""
|
||||||
echo "usage: $thisfilename -z <zone> -n <name> -t <type> -r <record> [-l <ttl>] [-s <status>] [-c <comment>] [-a <account>] [-h]"
|
echo "usage: $thisfilename -z <zone> -n <name> -t <type> -r <record> [-l <ttl>] [-s <status>] [-c <comment>] [-a <account>] [-h]"
|
||||||
|
|
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
||||||
|
|
||||||
help()
|
help()
|
||||||
{
|
{
|
||||||
thisfilename=$(basename -- "$0")
|
|
||||||
echo "$thisfilename"
|
|
||||||
echo "Search data in Zones, Comments and RRSets."
|
echo "Search data in Zones, Comments and RRSets."
|
||||||
echo ""
|
echo ""
|
||||||
echo "usage: $thisfilename -q <query> [-e <max>] [-o <object>] [-c] [-h]"
|
echo "usage: $thisfilename -q <query> [-e <max>] [-o <object>] [-c] [-h]"
|
||||||
|
@ -52,10 +50,8 @@ if [[ $zone_status = 200 ]]; then
|
||||||
# column output
|
# column output
|
||||||
dasel -r json -w csv -f $tmpfile|sed -e 's/"""/"/g'|column -t -s ','
|
dasel -r json -w csv -f $tmpfile|sed -e 's/"""/"/g'|column -t -s ','
|
||||||
fi
|
fi
|
||||||
elif [[ $zone_status = 404 ]]; then
|
|
||||||
echo 404 Not Found, $zone does not exist
|
|
||||||
else
|
else
|
||||||
echo Unexecpted http response checking for existence of zone $zone: $zone_status
|
echo Unexecpted http response seraching for $query: $zone_status
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm $tmpfile
|
rm $tmpfile
|
||||||
|
|
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
||||||
|
|
||||||
help()
|
help()
|
||||||
{
|
{
|
||||||
thisfilename=$(basename -- "$0")
|
|
||||||
echo "$thisfilename"
|
|
||||||
echo "Add new zone to DNS"
|
echo "Add new zone to DNS"
|
||||||
echo ""
|
echo ""
|
||||||
echo "usage: $thisfilename -z <zone> [-m <master>] [-t <type>] [-a <account>] [-w <comment>] [-b] [-h]"
|
echo "usage: $thisfilename -z <zone> [-m <master>] [-t <type>] [-a <account>] [-w <comment>] [-b] [-h]"
|
||||||
|
|
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
||||||
|
|
||||||
help()
|
help()
|
||||||
{
|
{
|
||||||
thisfilename=$(basename -- "$0")
|
|
||||||
echo "$thisfilename"
|
|
||||||
echo "Delete a zone and all of it's records."
|
echo "Delete a zone and all of it's records."
|
||||||
echo ""
|
echo ""
|
||||||
echo "usage: $thisfilename -z <zone> [-x] [-h]"
|
echo "usage: $thisfilename -z <zone> [-x] [-h]"
|
||||||
|
|
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
||||||
|
|
||||||
help()
|
help()
|
||||||
{
|
{
|
||||||
thisfilename=$(basename -- "$0")
|
|
||||||
echo "$thisfilename"
|
|
||||||
echo "Export full DNS zone in AXFR format."
|
echo "Export full DNS zone in AXFR format."
|
||||||
echo ""
|
echo ""
|
||||||
echo "usage: $thisfilename -z <zone> [-h]"
|
echo "usage: $thisfilename -z <zone> [-h]"
|
||||||
|
|
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
||||||
|
|
||||||
help()
|
help()
|
||||||
{
|
{
|
||||||
thisfilename=$(basename -- "$0")
|
|
||||||
echo "$thisfilename"
|
|
||||||
echo "Check if Zone is extant (exits)."
|
echo "Check if Zone is extant (exits)."
|
||||||
echo ""
|
echo ""
|
||||||
echo "usage: $thisfilename -z <zone> [-h]"
|
echo "usage: $thisfilename -z <zone> [-h]"
|
||||||
|
|
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
||||||
|
|
||||||
help()
|
help()
|
||||||
{
|
{
|
||||||
thisfilename=$(basename -- "$0")
|
|
||||||
echo "$thisfilename"
|
|
||||||
echo "Replace Resource Record set in zone."
|
echo "Replace Resource Record set in zone."
|
||||||
echo ""
|
echo ""
|
||||||
echo "usage: $thisfilename -z <zone> -n <name> -t <type> -r <record> [-l <ttl>] [-s <status>] [-c <comment>] [-a <account>] [-h]"
|
echo "usage: $thisfilename -z <zone> -n <name> -t <type> -r <record> [-l <ttl>] [-s <status>] [-c <comment>] [-a <account>] [-h]"
|
||||||
|
|
15
bin/pdns.sh
15
bin/pdns.sh
|
@ -30,6 +30,10 @@ fi
|
||||||
# Defaults to IP of server script is run from
|
# Defaults to IP of server script is run from
|
||||||
[[ -z $default_ip ]] && default_ip=$(hostname --ip-address)
|
[[ -z $default_ip ]] && default_ip=$(hostname --ip-address)
|
||||||
|
|
||||||
|
# Hostname of this server.
|
||||||
|
# Should normally just use the server configured hostname.
|
||||||
|
[[ -z $hostname ]] && hostname=$(hostname --fqdn)
|
||||||
|
|
||||||
# Array of allowed Resource Record Types
|
# Array of allowed Resource Record Types
|
||||||
[[ -z $rr_types ]] && declare -a rr_types=(A AAAA CNAME MX NS PTR SRV TXT)
|
[[ -z $rr_types ]] && declare -a rr_types=(A AAAA CNAME MX NS PTR SRV TXT)
|
||||||
|
|
||||||
|
@ -141,9 +145,15 @@ function pdns::yesno() {
|
||||||
|
|
||||||
function pdns:getoptions () {
|
function pdns:getoptions () {
|
||||||
local OPTIND
|
local OPTIND
|
||||||
while getopts "ha:bcd:e:i:l:m:n:o:q:r:s:t:w:xz:" opt ; do
|
while getopts "ha:bcd:e:i:l:m:n:o:p:q:r:s:t:w:xz:" opt ; do
|
||||||
case "${opt}" in
|
case "${opt}" in
|
||||||
h ) # display help and exit
|
h ) # display help and exit
|
||||||
|
# set thisfilename=$(basename -- "$0")
|
||||||
|
if [[ -n $parent ]]; then
|
||||||
|
thisfilename=$parent
|
||||||
|
else
|
||||||
|
thisfilename=$(basename -- "$0")
|
||||||
|
fi
|
||||||
help
|
help
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
|
@ -189,6 +199,9 @@ function pdns:getoptions () {
|
||||||
o ) # object_type - Type of data to search for, one of 'all', 'zone', 'record', 'comment'
|
o ) # object_type - Type of data to search for, one of 'all', 'zone', 'record', 'comment'
|
||||||
object=${OPTARG,,}
|
object=${OPTARG,,}
|
||||||
;;
|
;;
|
||||||
|
p ) # parent - name of parent script ("hidden" option used by vdns-* scripts)
|
||||||
|
parent=${OPTARG,,}
|
||||||
|
;;
|
||||||
q ) # query - The string to search for
|
q ) # query - The string to search for
|
||||||
query=${OPTARG}
|
query=${OPTARG}
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user