esx_update.sh hinzugefügt
This commit is contained in:
parent
38455aa664
commit
66a37d7791
1 changed files with 138 additions and 0 deletions
138
esx_update.sh
Normal file
138
esx_update.sh
Normal file
|
@ -0,0 +1,138 @@
|
|||
#!/bin/sh
|
||||
|
||||
# esxcli system maintenanceMode set --enable true
|
||||
# esxcli system maintenanceMode get
|
||||
|
||||
|
||||
|
||||
# wget --no-check-certificate https://git.gethome.at/max/esx_Update_Script/raw/branch/main/update.sh
|
||||
|
||||
|
||||
# esxcli network firewall ruleset list -r httpClient
|
||||
# esxcli network firewall ruleset set -e true -r httpClient
|
||||
|
||||
|
||||
|
||||
# grep 'mem=' /usr/lib/vmware/esxcli-software
|
||||
|
||||
# esxcli system settings advanced set -o /VisorFS/VisorFSPristineTardisk -i 0
|
||||
# cp /usr/lib/vmware/esxcli-software /usr/lib/vmware/esxcli-software.bak
|
||||
# sed -i 's/mem=500/mem=300/g' /usr/lib/vmware/esxcli-software.bak
|
||||
# mv /usr/lib/vmware/esxcli-software.bak /usr/lib/vmware/esxcli-software -f
|
||||
# esxcli system settings advanced set -o /VisorFS/VisorFSPristineTardisk -i 1
|
||||
|
||||
# esxcli software profile update -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml -p ESXi-8.0U3c-24414501-standard
|
||||
|
||||
|
||||
|
||||
|
||||
echo "ESX Update Script"
|
||||
echo "*****************"
|
||||
echo
|
||||
|
||||
|
||||
echo "checking ESXCLI memory limit ..."
|
||||
mem="$(grep 'mem=' /usr/lib/vmware/esxcli-software | cut -d'=' -f3)"
|
||||
updatemem=false
|
||||
|
||||
|
||||
if [ ${mem} -lt 500 ]
|
||||
then
|
||||
echo "ESXCLI memory ${mem}MB is too small"
|
||||
|
||||
|
||||
read -p "Update ESXCLI memory from ${mem}MB to 500MB? (y/N): " confirm
|
||||
case "$confirm" in
|
||||
[yY] | [yY][eE][Ss]) updatemem=true;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
|
||||
if [ "$updatemem" = true ]
|
||||
then
|
||||
echo "Update ESXCLI memory to 500MB ..."
|
||||
esxcli system settings advanced set -o /VisorFS/VisorFSPristineTardisk -i 0
|
||||
cp /usr/lib/vmware/esxcli-software /usr/lib/vmware/esxcli-software.bak
|
||||
sed -i 's/mem=300/mem=500/g' /usr/lib/vmware/esxcli-software.bak
|
||||
mv /usr/lib/vmware/esxcli-software.bak /usr/lib/vmware/esxcli-software -f
|
||||
esxcli system settings advanced set -o /VisorFS/VisorFSPristineTardisk -i 1
|
||||
else
|
||||
echo "ESXCLI memory is ${mem}MB"
|
||||
echo "Script can't run with this config"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
else
|
||||
echo "ESXCLI memory ${mem}MB is big enough"
|
||||
fi
|
||||
|
||||
|
||||
echo
|
||||
echo "checking Current version ..."
|
||||
echo
|
||||
|
||||
current="$(esxcli software profile get | sed '1!d' \
|
||||
| cut -d' ' -f2)"
|
||||
echo "Current Version: ${current}"
|
||||
|
||||
echo
|
||||
echo "checking Latest version of ESXi ..."
|
||||
echo "this may take some time"
|
||||
echo
|
||||
|
||||
latest="$(esxcli software sources profile list \
|
||||
--depot=https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml \
|
||||
| sort -k4 \
|
||||
| tail -2 | head -1 \
|
||||
| sed \
|
||||
-e 's/VMware.*$//' )"
|
||||
echo "Latest Version: ${latest}"
|
||||
echo
|
||||
|
||||
|
||||
if [ ${current}=${latest} ]
|
||||
then
|
||||
echo "System is Up to date"
|
||||
echo
|
||||
exit 1
|
||||
else
|
||||
read -p "Update host from ${current} to ${latest}? (y/N): " confirm
|
||||
case "$confirm" in
|
||||
[yY] | [yY][eE][Ss]) update=true;;
|
||||
*) exit 1;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ "$update" = true ]
|
||||
then
|
||||
|
||||
#esxcli system maintenanceMode get
|
||||
|
||||
mmode="$(esxcli system maintenanceMode get)"
|
||||
echo "Maintenance Mode: ${mmode}"
|
||||
|
||||
if [ ${mmode}=='Disabled' ]
|
||||
then
|
||||
changemode = false
|
||||
echo "Maintenance Mode needs to be enabled"
|
||||
read -p "enable Maintenance Mode? (y/N): " confirm
|
||||
case "$confirm" in
|
||||
[yY] | [yY][eE][Ss]) changemode=true;;
|
||||
*) ;;
|
||||
esac
|
||||
if [ "$changemode" = true ]
|
||||
then
|
||||
esxcli system maintenanceMode set --enable true
|
||||
else
|
||||
echo "Maintenance Mode needs to be enabled"
|
||||
echo "Script can't run with this config"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
else
|
||||
echo "Updating to ${latest}..."
|
||||
esxcli software profile update -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml -p ${latest}
|
||||
fi
|
||||
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue