Linux 使用ntpdate自动对时

1. 建立crontab的脚本

    $ vi /etc/cron.daily/ntpupdatedaily

添加如下行:

    #!/bin/bash
    ntpdate stdtime.gov.hk

2. 添加到crontab任务

    $ crontab -e

在最后添加(表示每天晚上20:00以root身份运行/etc/cron.daily/ntpupdatedaily):

    00 20 * * * root /etc/cron.daily/ntpupdatedaily

By Leslie Guan

posted @ 2014-06-05 10:30  Leslie Guan  阅读(1098)  评论(0)    收藏  举报