Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 90fa146190 | |||
| c3ed03e865 | |||
| 87250d5c77 |
@@ -5,9 +5,23 @@ usage() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Started ${0} ${*} ..."
|
get_user_hosts() {
|
||||||
|
local User=${1}
|
||||||
|
local Domain=${2}
|
||||||
|
|
||||||
|
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}
|
||||||
|
}
|
||||||
|
|
||||||
Domain=cvtt.vpn
|
Domain=cvtt.vpn
|
||||||
|
echo "Started ${0} ${*} ..."
|
||||||
|
|
||||||
RootDir=${1}
|
RootDir=${1}
|
||||||
|
|
||||||
if [ ! -d "${RootDir}" ]; then
|
if [ ! -d "${RootDir}" ]; then
|
||||||
@@ -21,14 +35,12 @@ echo ${Cmd} && eval ${Cmd}
|
|||||||
for User in cvtt oleg
|
for User in cvtt oleg
|
||||||
do
|
do
|
||||||
echo "User=$User"
|
echo "User=$User"
|
||||||
# hosts=$(curl -s http://cloud23.cvtt.vpn:6789/admin/cvtt_hosts | jq -r --arg domain "${Domain}" --arg usr ${User} '.[$domain] | to_entries[] | select(.value.users[] | contains($usr)) | .key')
|
Cmd="mkdir -p ${RootDir}/${User}"
|
||||||
hosts=$(
|
echo ${Cmd} && eval ${Cmd}
|
||||||
curl -s http://cloud23.cvtt.vpn:6789/admin/cvtt_hosts | jq -r \
|
|
||||||
--arg domain "${Domain}" \
|
hosts=$(get_user_hosts ${User} ${Domain})
|
||||||
--arg usr "${User}" \
|
echo ${hosts}
|
||||||
'.[$domain] | to_entries[] | select(.value.users[] | contains($usr)) | .key'
|
|
||||||
)
|
|
||||||
mkdir -p ${RootDir}/${User}
|
|
||||||
for host in ${hosts}
|
for host in ${hosts}
|
||||||
do
|
do
|
||||||
echo "===================="
|
echo "===================="
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
1.3.1
|
1.3.3
|
||||||
|
|||||||
Reference in New Issue
Block a user