成都创新互联网站制作重庆分公司

python开发时间同步脚本

#!/usr/bin/env python
#coding:utf-8

#Example:
#ntpdate -u 0.asia.pool.ntp.org 1.asia.pool.ntp.org 2.asia.pool.ntp.org 3.asia.pool.ntp.org cn.ntp.org.cn  time.nuri.net 

import os
command = ['ntpdate cn.ntp.org.cn',
           'rm -rf /etc/localtime',
           'ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime',
           'hwclock -w',
           "export TZ='Asia/Shanghai'",
           'echo "export TZ=\'Asia/Shanghai\'" >> /root/.bashrc']
for com in command:
    os.system(com)  

当前名称:python开发时间同步脚本
分享URL:http://cxhlcq.com/article/gcjhcd.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部