Fixed ubuntu
This commit is contained in:
1 parent
832d59cab2
commit
2bc951824a
2 files changed
+65
-11
No files matched your search
+56
-7
@@ -46,7 +46,54 @@ case $(uname) in
|
||||
esac
|
||||
|
||||
# Get script dir
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# See: http://stackoverflow.com/a/29835459/4449544
|
||||
rreadlink() ( # Execute the function in a *subshell* to localize variables and the effect of `cd`.
|
||||
|
||||
target=$1 fname= targetDir= CDPATH=
|
||||
|
||||
# Try to make the execution environment as predictable as possible:
|
||||
# All commands below are invoked via `command`, so we must make sure that `command`
|
||||
# itself is not redefined as an alias or shell function.
|
||||
# (Note that command is too inconsistent across shells, so we don't use it.)
|
||||
# `command` is a *builtin* in bash, dash, ksh, zsh, and some platforms do not even have
|
||||
# an external utility version of it (e.g, Ubuntu).
|
||||
# `command` bypasses aliases and shell functions and also finds builtins
|
||||
# in bash, dash, and ksh. In zsh, option POSIX_BUILTINS must be turned on for that
|
||||
# to happen.
|
||||
{ \unalias command; \unset -f command; } >/dev/null 2>&1
|
||||
[ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on # make zsh find *builtins* with `command` too.
|
||||
|
||||
while :; do # Resolve potential symlinks until the ultimate target is found.
|
||||
[ -L "$target" ] || [ -e "$target" ] || { command printf '%s\n' "ERROR: '$target' does not exist." >&2; return 1; }
|
||||
command cd "$(command dirname -- "$target")" # Change to target dir; necessary for correct resolution of target path.
|
||||
fname=$(command basename -- "$target") # Extract filename.
|
||||
[ "$fname" = '/' ] && fname='' # !! curiously, `basename /` returns '/'
|
||||
if [ -L "$fname" ]; then
|
||||
# Extract [next] target path, which may be defined
|
||||
# *relative* to the symlink's own directory.
|
||||
# Note: We parse `ls -l` output to find the symlink target
|
||||
# which is the only POSIX-compliant, albeit somewhat fragile, way.
|
||||
target=$(command ls -l "$fname")
|
||||
target=${target#* -> }
|
||||
continue # Resolve [next] symlink target.
|
||||
fi
|
||||
break # Ultimate target reached.
|
||||
done
|
||||
targetDir=$(command pwd -P) # Get canonical dir. path
|
||||
# Output the ultimate target's canonical path.
|
||||
# Note that we manually resolve paths ending in /. and /.. to make sure we have a normalized path.
|
||||
if [ "$fname" = '.' ]; then
|
||||
command printf '%s\n' "${targetDir%/}"
|
||||
elif [ "$fname" = '..' ]; then
|
||||
# Caveat: something like /var/.. will resolve to /private (assuming /var@ -> /private/var), i.e. the '..' is applied
|
||||
# AFTER canonicalization.
|
||||
command printf '%s\n' "$(command dirname -- "${targetDir}")"
|
||||
else
|
||||
command printf '%s\n' "${targetDir%/}/$fname"
|
||||
fi
|
||||
)
|
||||
|
||||
DIR=$(dirname -- "$(rreadlink "$0")")
|
||||
|
||||
# Global Variables:
|
||||
|
||||
@@ -58,7 +105,7 @@ arPass=""
|
||||
|
||||
# Load config
|
||||
|
||||
source $DIR/dns.conf
|
||||
#. $DIR/dns.conf
|
||||
|
||||
# Get Domain IP
|
||||
# arg: domain
|
||||
@@ -124,8 +171,10 @@ arDdnsCheck() {
|
||||
}
|
||||
|
||||
# DDNS
|
||||
echo ${#domains[@]}
|
||||
for index in ${!domains[@]}; do
|
||||
echo "${domains[index]} ${subdomains[index]}"
|
||||
arDdnsCheck "${domains[index]}" "${subdomains[index]}"
|
||||
done
|
||||
#echo ${#domains[@]}
|
||||
#for index in ${!domains[@]}; do
|
||||
# echo "${domains[index]} ${subdomains[index]}"
|
||||
# arDdnsCheck "${domains[index]}" "${subdomains[index]}"
|
||||
#done
|
||||
|
||||
. $DIR/dns.conf
|
||||
+9
-4
@@ -1,5 +1,10 @@
|
||||
arMail="test@gmail.com"
|
||||
arPass="test"
|
||||
# For security reasons, it is recommended that you use token-based auth instead
|
||||
# arMail="test@gmail.com"
|
||||
# arPass="123"
|
||||
|
||||
declare -a domains=("test.net")
|
||||
declare -a subdomains=("abc")
|
||||
# Combine your token ID and token together as follows
|
||||
arToken="12345,7676f344eaeaea9074c123451234512d"
|
||||
|
||||
# Place each domain you want to check as follows
|
||||
# you can have multiple arDdnsCheck blocks
|
||||
arDdnsCheck "test.org" "subdomain"
|
||||
Reference in new issue
Block a user