Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c3ed03e865 | |||
| 87250d5c77 | |||
| b1fe4f38f0 | |||
| c7e717a64f | |||
| c6b99f6678 | |||
| 6c771ad1a1 |
+31
-11
@@ -5,7 +5,21 @@ usage() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "Started ${*} ..."
|
||||
get_hosts_json() {
|
||||
curl -s http://cloud23.cvtt.vpn:6789/admin/cvtt_hosts | ${HOME}/bin/hjson -j
|
||||
}
|
||||
|
||||
get_user_hosts() {
|
||||
User=${1}
|
||||
Domain=${2}
|
||||
|
||||
get_hosts_json | jq -r \
|
||||
--arg domain "${Domain}" \
|
||||
--arg usr "${User}" \
|
||||
'.[$domain] | to_entries[] | select(.value.users[] | contains($usr)) | .key'
|
||||
}
|
||||
|
||||
echo "Started ${0} ${*} ..."
|
||||
|
||||
Domain=cvtt.vpn
|
||||
RootDir=${1}
|
||||
@@ -13,29 +27,35 @@ RootDir=${1}
|
||||
if [ ! -d "${RootDir}" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
cd ${RootDir}
|
||||
Cmd="git pull"
|
||||
echo ${Cmd} && eval ${Cmd}
|
||||
|
||||
for User in cvtt oleg
|
||||
do
|
||||
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')
|
||||
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'
|
||||
)
|
||||
hosts=$(get_user_hosts ${User} ${Domain})
|
||||
mkdir -p ${RootDir}/${User}
|
||||
print ${hosts}
|
||||
exit
|
||||
for host in ${hosts}
|
||||
do
|
||||
echo "===================="
|
||||
echo "${host}"
|
||||
ssh ${User}@${host}.${Domain} 'crontab -l' | tee ${RootDir}/${User}/${host}.cron
|
||||
echo "${host}:${User}"
|
||||
Cmd="ssh ${User}@${host}.${Domain} 'crontab -l' | tee ${RootDir}/${User}/${host}.cron"
|
||||
echo ${Cmd} && eval ${Cmd}
|
||||
done
|
||||
done
|
||||
|
||||
cd ${RootDir}
|
||||
|
||||
Cmd="find -type f -empty -delete -print"
|
||||
echo ${Cmd} && eval ${Cmd}
|
||||
|
||||
Cmd="find -type d -empty -delete -print"
|
||||
echo ${Cmd} && eval ${Cmd}
|
||||
|
||||
Cmd="git add ."
|
||||
echo ${Cmd} && eval ${Cmd}
|
||||
|
||||
@@ -45,4 +65,4 @@ echo ${Cmd} && eval ${Cmd}
|
||||
Cmd="git pushall"
|
||||
echo ${Cmd} && eval ${Cmd}
|
||||
|
||||
echo "${0} Done."
|
||||
echo "Done ${0} ${*}"
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
1.2.6
|
||||
1.3.2
|
||||
|
||||
Reference in New Issue
Block a user