Skip to content

Commit

Permalink
# improve
Browse files Browse the repository at this point in the history
  • Loading branch information
czy21 committed Aug 12, 2024
1 parent 2ca9c7c commit cd72de2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/router/watchcat/conf/esxi.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ esxi_host_cmd="ssh esxi"

function close_vms(){
for t in $1;do
if [ `$esxi_host_cmd vim-cmd vmsvc/power.getstate $t | grep 'Powered on' -q && echo true` ];then
if `$esxi_host_cmd vim-cmd vmsvc/power.getstate $t | grep 'Powered on' -q`;then
vm_name=`$esxi_host_cmd vim-cmd vmsvc/get.summary $t | grep name`
if [ `$esxi_host_cmd vim-cmd vmsvc/get.summary $t | grep toolsOk -q && echo true` ];then
if `$esxi_host_cmd vim-cmd vmsvc/get.summary $t | grep 'toolsOk' -q`;then
logger -t "${LOG_TAG}" "id: $t $vm_name power.shutdown"
$esxi_host_cmd vim-cmd vmsvc/power.shutdown $t
else
Expand All @@ -24,7 +24,7 @@ function check_vms(){
while [ $vms_off == false ]
do
for t in $1;do
vms_off=`$esxi_host_cmd vim-cmd vmsvc/power.getstate $t | grep 'Powered off' -q && echo true || false`
vms_off=`$esxi_host_cmd vim-cmd vmsvc/power.getstate $t | grep 'Powered off' -q && echo true || echo false`
done
done
}
Expand Down
2 changes: 2 additions & 0 deletions server/router/watchcat/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ param_command="{{ param_command }}"
etc_app_path="{{ param_app_path }}"
if [ "install" = "${param_command}" ];then
mkdir -p ${etc_app_path} && cp -r {{ param_role_output_path }}/conf/* ${etc_app_path}
chmod +x ${etc_app_path}/*.sh
fi

if [ "backup" = "${param_command}" ];then
Expand All @@ -12,4 +13,5 @@ fi

if [ "restore" = "${param_command}" ];then
mkdir -p ${etc_app_path} && cp -r {{ param_role_bak_path }}/* ${etc_app_path}
chmod +x ${etc_app_path}/*.sh
fi

0 comments on commit cd72de2

Please sign in to comment.