ESXi 时间 时间不对的问题

ESXi 6.x只能显示UTC时间,还不能修改

替换localtime文件后,可以解决,但重启文件又恢复,找到以下方法

在文件:/etc/rc.local.d/local.sh 的exit 0之前添加以下脚本

#Add script to /etc/rc.local.d/local.sh before 'exit 0' in VMWare esxi 5.x/6.x
#以下请设置临时文件路径/Set temp script file path
temp_shell_script_path="/tmp/set_timezone.sh"
#以下请设置localtime路径(如需测试请填写其它自定义路径,默认请填写/etc/localtime),Set localtime file path,e.g. "/etc/localtime"
sys_localtime_path="/etc/localtime"
#In python echo base64,because VMWare ESxi have no command "base64".
echo "#Beijing Joycore Technology Co., Ltd. " > $temp_shell_script_path
echo "#Set Timezone For VMWARE-ESXI 5.x/6.x" >> $temp_shell_script_path 
echo "import base64" >> $temp_shell_script_path
echo "str_timezone  = 'VFppZjIAAAAAAAAAAAAAAAAAAAAAAAADAAAAAwAAAAAAAAARAAAAAwAAAAyw/pqgyFwBgMj6J3DJ'" >>  $temp_shell_script_path
echo "str_timezone  = str_timezone + '1Q6Aytta8B66NgAfaX9wIH5ogCFJYXAiXkqAIylDcCRHZwAlEl/wJidJACbyQfAoBysAKNIj8AIB'" >> $temp_shell_script_path
echo "str_timezone  = str_timezone + 'AgECAQIBAgECAQIBAgECAABx4AAAAAB+kAEEAABwgAAITE1UAENEVABDU1QAAAAAAAAAVFppZjIA'" >> $temp_shell_script_path
echo "str_timezone  = str_timezone + 'AAAAAAAAAAAAAAAAAAAAAAADAAAAAwAAAAAAAAARAAAAAwAAAAz/////sP6aoP/////IXAGA////'" >> $temp_shell_script_path
echo "str_timezone  = str_timezone + '/8j6J3D/////ydUOgP/////K21rwAAAAAB66NgAAAAAAH2l/cAAAAAAgfmiAAAAAACFJYXAAAAAA'" >> $temp_shell_script_path
echo "str_timezone  = str_timezone + 'Il5KgAAAAAAjKUNwAAAAACRHZwAAAAAAJRJf8AAAAAAmJ0kAAAAAACbyQfAAAAAAKAcrAAAAAAAo'" >> $temp_shell_script_path
echo "str_timezone  = str_timezone + '0iPwAgECAQIBAgECAQIBAgECAQIAAHHgAAAAAH6QAQQAAHCAAAhMTVQAQ0RUAENTVAAAAAAAAAAK'" >> $temp_shell_script_path
echo "str_timezone  = str_timezone + 'Q1NULTgK'" >>  $temp_shell_script_path
echo "#Print file /usr/share/zoneinfo/Asia/Shanghai source from Centos 6.x" >>  $temp_shell_script_path
echo "fout = open(r'$sys_localtime_path', 'wb')" >>  $temp_shell_script_path
echo "fout.write(base64.b64decode(str_timezone))" >>  $temp_shell_script_path
echo "fout.close" >>  $temp_shell_script_path
#delete old file who names localtime
rm -f $sys_localtime_path
#rebuild new file with localtime
python $temp_shell_script_path
#delete temp python script
rm -f $temp_shell_script_path
echo "JOYCORE:TIMEZONE UPDATED .......... OK"

 

Win环境下复制的注意行尾符号

 

原文:https://blog.csdn.net/rareli/article/details/78851397

发表评论

电子邮件地址不会被公开。