close

用SSH連入ESXi Server輸入date指令,你會發現時間跟vSphere Client的時間不一致,原因是UTC問題,詳細可以看這篇

https://blog.51cto.com/jdonghong/1957118

先在本機電腦建立下面檔案,用WinSCP連入ESXi Server,把檔案放在ESXi Server的localdisk內

建立smtp.xml檔案(開放STMP 25讓ghettoVCB備份程式可以發信通知結果)
=====================================
<!-- E-MAIL SMTP -->  
<ConfigRoot> 
   <service id='1000'> 
     <id>SMTP</id> 
     <rule> 
       <direction>outbound</direction> 
       <protocol>tcp</protocol> 
       <porttype>dst</porttype> 
       <port>25</port> 
     </rule> 
     <enabled>true</enabled> 
     <required>false</required> 
   </service> 
</ConfigRoot> 
=====================================

建立root檔案(使用ghettoVCB備份方式排程用,可GOOGLE一下用法)
=====================================
#系統預設
1    1    *   *   *   /sbin/tmpwatch.py
1    *    *   *   *   /sbin/auto-backup.sh
0    *    *   *   *   /usr/lib/vmware/vmksummary/log-heartbeat.py
*/5  *    *   *   *   /sbin/hostd-probe

#ghettoVCB Backup 每天01:01備份至nas
01   1    *   *   *   /vmfs/volumes/LocalDisk-DS42/ghettoVCB-master/ghettoVCB-22.sh -f /vmfs/volumes/LocalDisk-DS42/ghettoVCB-master/vms_to_backup -d debug
30   4    *   *   *   /vmfs/volumes/LocalDisk-DS42/ghettoVCB-master/ghettoVCB-LocalDisk.sh -f /vmfs/volumes/LocalDisk-DS42/ghettoVCB-master/vms_to_backup -d debug
=====================================

建立local.sh檔案
=====================================
#!/bin/sh

# local configuration options

# Note: modify at your own risk!  If you do/use anything in this
# script that is not part of a stable API (relying on files to be in
# specific places, specific tools, specific output, etc) there is a
# possibility you will end up with a broken system after patching or
# upgrading.  Changes are not supported unless under direction of
# VMware support.

# ghettoVCB Crontabs
/bin/kill $(cat /var/run/crond.pid)
cp /vmfs/volumes/LocalDisk-DS42/root /var/spool/cron/crontabs
sleep 2
/usr/lib/vmware/busybox/bin/busybox crond

# Firewall rules
cp /vmfs/volumes/LocalDisk-DS42/smtp.xml /etc/vmware/firewall/
sleep 2
esxcli network firewall refresh

#LocalTime
rm /etc/localtime
cp /vmfs/volumes/LocalDisk-DS42/localtime /etc/

exit 0
=====================================

localtime可到下面抓取
https://drive.google.com/file/d/1RCJ9KnVKN8J9hMUqD2P9bWM9qpEajgy9/view?usp=sharing


LocalTime處理方式在ESXi 6.7上若直接用CP指令覆蓋,會有權限問題,所以要先刪除rm /etc/localtime,再用CP指令複製過去,這樣ESXi主機時區就會是UTC+8

rm /etc/localtime
cp /vmfs/volumes/LocalDisk-DS42/localtime /etc/

ESXi主機重開機這些設定都會重置,所以要使用local.sh來處理,將local.sh用WinSCP連入覆蓋/etc/rc.local.d/local.sh後,每次ESXi主機重開機就會執行這些動作不用再手動處理。

arrow
arrow
    文章標籤
    時區 ESXi VM UTC 非同步
    全站熱搜
    創作者介紹
    創作者 NoMoney NoHoney 的頭像
    NoMoney NoHoney

    No Money No Honey

    NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣()