update
This commit is contained in:
@@ -1,10 +1,14 @@
|
|||||||
#!/usr/bin/env pwsh
|
#!/usr/bin/env pwsh
|
||||||
|
|
||||||
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false | Out-Null
|
|
||||||
. /opt/idssys/powerwall/settings.ps1
|
. /opt/idssys/powerwall/settings.ps1
|
||||||
|
|
||||||
Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -Password $ESXiPassword | Out-Null
|
Connect-VIServer -Server $VCENTERHOST -Protocol https -User $VCENTERUSER -Password $VCENTERPASS | Out-Null
|
||||||
|
|
||||||
Get-VM | Where {$_.PowerState -like '*On*' -and $_.Name -notlike '*CLS*' -and $_.Name -notlike '*iSCSI*'} | Shutdown-VMGuest -Confirm:$false
|
#Get-VMHost | Where {$args[0]} | Get-VM | Where {$_.PowerState -like '*On*' -and $_.Name -notlike '*CLS*' -and $_.Name -notlike '*iSCSI*'} | Shutdown-VMGuest -Confirm:$false
|
||||||
|
|
||||||
Disconnect-VIServer -Server $args[0] -Force –Confirm:$false
|
Get-VMHost | Where {$args[0]} | Get-VM | Where {$_.PowerState -like '*On*' -and $_.Name -notlike '*CLS*' -and $_.Name -notlike '*iSCSI*'}
|
||||||
|
|
||||||
|
Disconnect-VIServer -Server $VCENTERHOST -Force –Confirm:$false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#$_.Name -eq 'ids-vms1.scity.us' -or $_.Name -eq 'ids-vms7.scity.us'
|
||||||
30
powerwall.sh
30
powerwall.sh
@@ -363,23 +363,33 @@ SHUTDOWN_SERVER(){
|
|||||||
echo -en "${idsCL[White]}${MSG}${idsCL[White]}${MSG_SPC}: "
|
echo -en "${idsCL[White]}${MSG}${idsCL[White]}${MSG_SPC}: "
|
||||||
# for ESXIHOST in "${PW_MAINSITEHOSTS[@]}"; do
|
# for ESXIHOST in "${PW_MAINSITEHOSTS[@]}"; do
|
||||||
if [ "${TEST}" != "true" ]; then
|
if [ "${TEST}" != "true" ]; then
|
||||||
|
if [ "${1}" == "10.10.2.10" ] || [ "${1}" == "MAIN" ]; then
|
||||||
|
${PW_FOLDER}/esxi-scripts/iscsi-vm-shutdown-verify.ps1 >/dev/null 2>&1
|
||||||
|
elif [ "${1}" == "10.10.2.17" ] || [ "${1}" == "SYS" ]; then
|
||||||
|
${PW_FOLDER}/esxi-scripts/iscsi-sys-vm-shutdown-verify.ps1 >/dev/null 2>&1
|
||||||
|
elif [ "${1}" == "MAINSITE" ] || [ "${1}" == "ALL" ]; then
|
||||||
|
${PW_FOLDER}/esxi-scripts/iscsi-all-shutdown-verify.ps1 >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
||||||
# if [ "$(ipmitool -I lanplus -H ${PW_HOST_IDRACS[${PW_ESXI_HOST_NAMES[${ESXIHOST}]}]} -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" chassis power status | grep 'Power is on')" != "" ] && [ "$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${ESXIHOST} 'esxcli system maintenanceMode get')" != "Enabled" ]; then
|
# if [ "$(ipmitool -I lanplus -H ${PW_HOST_IDRACS[${PW_ESXI_HOST_NAMES[${ESXIHOST}]}]} -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" chassis power status | grep 'Power is on')" != "" ] && [ "$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${ESXIHOST} 'esxcli system maintenanceMode get')" != "Enabled" ]; then
|
||||||
VERIFY_ISCSI_VM_DOWN "${ESXI_HOST}" &
|
# VERIFY_ISCSI_VM_DOWN "${ESXI_HOST}" &
|
||||||
# else
|
# else
|
||||||
# touch ${PW_TMPFOLDER}/verify.iscsi.${ESXIHOST}.done
|
# touch ${PW_TMPFOLDER}/verify.iscsi.${ESXIHOST}.done
|
||||||
# fi
|
# fi
|
||||||
fi
|
|
||||||
# done
|
|
||||||
|
|
||||||
if [ "${TEST}" != "true" ]; then
|
|
||||||
nc_count=0
|
|
||||||
until [ -f ${PW_TMPFOLDER}/verify.iscsi.done ]; do
|
|
||||||
sleep 1s
|
|
||||||
done
|
|
||||||
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
|
||||||
else
|
else
|
||||||
echo -e "${idsCL[Yellow]}(TEST MODE)${idsCL[Default]}"
|
echo -e "${idsCL[Yellow]}(TEST MODE)${idsCL[Default]}"
|
||||||
fi
|
fi
|
||||||
|
# done
|
||||||
|
|
||||||
|
# if [ "${TEST}" != "true" ]; then
|
||||||
|
# nc_count=0
|
||||||
|
# until [ -f ${PW_TMPFOLDER}/verify.iscsi.done ]; do
|
||||||
|
# sleep 1s
|
||||||
|
# done
|
||||||
|
# echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
||||||
|
# else
|
||||||
|
# echo -e "${idsCL[Yellow]}(TEST MODE)${idsCL[Default]}"
|
||||||
|
# fi
|
||||||
|
|
||||||
if [ "${ESXI_HOST}" == "10.10.2.10" ] || [ "${ESXI_HOST}" == "MAIN" ] || [ "${ESXI_HOST}" == "CONSERVE" ]; then
|
if [ "${ESXI_HOST}" == "10.10.2.10" ] || [ "${ESXI_HOST}" == "MAIN" ] || [ "${ESXI_HOST}" == "CONSERVE" ]; then
|
||||||
MSG="Shutting down iSCSI-PRI Server"
|
MSG="Shutting down iSCSI-PRI Server"
|
||||||
|
|||||||
Reference in New Issue
Block a user