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