fix
This commit is contained in:
parent
c3ed03e865
commit
90fa146190
@ -5,23 +5,23 @@ usage() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
get_hosts_json() {
|
||||
curl -s http://cloud23.cvtt.vpn:6789/admin/cvtt_hosts | ${HOME}/bin/hjson -j
|
||||
}
|
||||
|
||||
get_user_hosts() {
|
||||
User=${1}
|
||||
Domain=${2}
|
||||
local User=${1}
|
||||
local Domain=${2}
|
||||
|
||||
get_hosts_json | jq -r \
|
||||
--arg domain "${Domain}" \
|
||||
--arg usr "${User}" \
|
||||
'.[$domain] | to_entries[] | select(.value.users[] | contains($usr)) | .key'
|
||||
Cmd="curl -s http://cloud23.cvtt.vpn:6789/admin/cvtt_hosts"
|
||||
Cmd="${Cmd} | ${HOME}/bin/hjson -j"
|
||||
Cmd="${Cmd} | jq -r"
|
||||
Cmd="${Cmd} --arg domain \"${Domain}\""
|
||||
Cmd="${Cmd} --arg usr \"${User}\""
|
||||
Cmd="${Cmd} '.[\$domain] | to_entries[] | select(.value.users[] | contains(\$usr)) | .key'"
|
||||
# echo $Cmd ### - FOR DEBUG ONLY
|
||||
eval ${Cmd}
|
||||
}
|
||||
|
||||
echo "Started ${0} ${*} ..."
|
||||
|
||||
Domain=cvtt.vpn
|
||||
echo "Started ${0} ${*} ..."
|
||||
|
||||
RootDir=${1}
|
||||
|
||||
if [ ! -d "${RootDir}" ]; then
|
||||
@ -35,10 +35,12 @@ echo ${Cmd} && eval ${Cmd}
|
||||
for User in cvtt oleg
|
||||
do
|
||||
echo "User=$User"
|
||||
Cmd="mkdir -p ${RootDir}/${User}"
|
||||
echo ${Cmd} && eval ${Cmd}
|
||||
|
||||
hosts=$(get_user_hosts ${User} ${Domain})
|
||||
mkdir -p ${RootDir}/${User}
|
||||
print ${hosts}
|
||||
exit
|
||||
echo ${hosts}
|
||||
|
||||
for host in ${hosts}
|
||||
do
|
||||
echo "===================="
|
||||
|
||||
@ -1 +1 @@
|
||||
1.3.2
|
||||
1.3.3
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user