主机与ntp时间同步脚本

来源:互联网 发布:易用软件用户密码 编辑:程序博客网 时间:2024/05/06 04:41
#!/bin/bashntpServer=$NTP_SERVERif grep -q "/sbin/hwclock -w) &> /var/log/ntpdate.log" /etc/crontabthen  echo "The cron job is setted for NTP SERVER!"  exitelse    echo "*/10 * * * * root (/usr/sbin/ntpdate $ntpServer && /sbin/hwclock -w) &> /var/log/ntpdate.log" >> /etc/crontab   #restart the cron   /etc/init.d/crond restartfi         
0 0
原创粉丝点击