1.修改主机名称:
esxcli system hostname set --host=hostname
2.修改/etc/rc.local.d/local.sh
cp -f /vmfs/volumes/datastore1/Shanghai /etc/localtime
/bin/kill $(cat /var/run/crond.pid)
/bin/echo '0 4 * * 6 /vmfs/volumes/datastore1/autoreboot.sh >> /vmfs/volumes/datastore1/autoreboot.log 2>&1' >> /var/spool/cron/crontabs/root
/usr/lib/vmware/busybox/bin/busybox crond
exit 0
3.重启脚本(/vmfs/volume/datastore1/autoreboot.sh):
#!/bin/sh
#shutdown all VMs(3,7,8 is VMID,add your VMIDs here)
echo $(date +%Y/%m/%d-%H:%M) Starting Power Off VMs...
/bin/vim-cmd vmsvc/power.off 3
/bin/vim-cmd vmsvc/power.off 7
/bin/vim-cmd vmsvc/power.off 8
#Reboot Host
echo $(date +%Y/%m/%d-%H:%M) Starting Reboot ESXI...
/sbin/reboot
4.更新证书后重启服务:
/etc/init.d/hostd restart
/etc/init.d/vpxa restart