zoukankan      html  css  js  c++  java
  • crontab,ntpdate

    点击查看

    crontab,, 计划任务

    通常与时间同步搭配使用,,

    客户端操作
    客户端跟服务器进行时间同步(ntpdate 服务器端的IP)
    [root@king ~]# yum install ntpdate -y

    cron计划任务的执行,结果并不会显示在终端,而是以邮件的方式通知用户,,

      crontab

    命令

    * * * * * root run-parts command
    

    分 时 日 月 周

    第1列:表示分钟1~59 每分钟用*或者 */1表示
    第2列:表示小时1~23(0表示0点)
    第3列:表示日期1~31
    第4列:表示月份1~12
    第5列:标识号星期0~6(0表示星期天)
    第6列:要运行的命令
    root:以root用户运行,

    1、编写计划任务,也可以在vim模式直接删除
    [root@server ~]# crontab -e
    2 16 * * * /sbin/shutdown -h now //每天下午4点2分执行关机
    2、查看计划任务
    [root@server ~]# crontab -l
    2 16 * * * /sbin/shutdown -h now

    同步国际ntp时间地址,也可以同步阿里云的

    ntpdate pool.ntp.org,ntp.aliyun.com
    

    crontab与ntpdate联动,使用计划任务执行每一分钟同步阿里云时间同步服务器

    [root@localhost ~]# crontab -l
    */1 * * * * /usr/sbin/ntpdate ntp.aliyun.com

     

  • 相关阅读:
    15-01-18 C# 面向对象 13
    15-01-15 C# 面向对象 12
    15-01-12 C# 面向对象 11
    15-01-11 C# 面向对象 10
    15-01-10 C# 面向对象 09
    了解 Azure 中的无服务器计算
    了解 Azure 虚拟机
    什么是 Azure?
    云服务的类型
    云部署模型
  • 原文地址:https://www.cnblogs.com/5444de/p/12484852.html
Copyright © 2011-2022 走看看