1,"/etc/crontab"文件

[root@localhost ~]# more /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root # For details see man crontabs # Example of job definition:
# .---------------- minute ( - )
# | .------------- hour ( - )
# | | .---------- day of month ( - )
# | | | .------- month ( - ) OR jan,feb,mar,apr ...
# | | | | .---- day of week ( - ) (Sunday= or ) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed

2,检查crond服务是否启动,crontab命令格式后,还是无法同步。查看crontab日志

From root@localhost.localdomain  Sat Feb  ::
Return-Path: <root@localhost.localdomain>
X-Original-To: root
Delivered-To: root@localhost.localdomain
Received: by localhost.localdomain (Postfix, from userid )
id B340060ADA00; Sat, Feb :: + (CST)
From: "(Cron Daemon)" <root@localhost.localdomain>
To: root@localhost.localdomain
Subject: Cron <root@localhost> root ntpdate -u 192.168.10.10
Content-Type: text/plain; charset=UTF-
Auto-Submitted: auto-generated
Precedence: bulk
X-Cron-Env: <XDG_SESSION_ID=>
X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/>
X-Cron-Env: <LANG=en_US.UTF->
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>
Message-Id: <.B340060ADA00@localhost.localdomain>
Date: Sat, Feb :: + (CST) /bin/sh: root: command not found

3,发现"/bin/sh: root: command not found",需要改成绝对路径

[root@localhost ~]# whereis crontab
crontab: /usr/bin/crontab /etc/crontab /usr/share/man/man1/crontab..gz /usr/share/man/man5/crontab..gz
[root@localhost ~]# whereis clock
clock: /usr/sbin/clock /usr/share/man/man8/clock..gz
[root@localhost ~]# crontab -e

  * * *  /usr/sbin/ntpdate -u  192.168.10.10; /usr/sbin/clock -w 

RHEL7学习之crontab无法执行ntpdate的更多相关文章

  1. crontab下设置ntpdate的问题

    1.在crontab里设置了ntpdate 同步时间,一段时间发现没有起作用 原来的写法是 20 00 × × × ntpdate cn.pool.ntp.org 单独拿出来执行也是没问题的,最近好好 ...

  2. 机器重启 查看crontab执行历史记录crontab没有执行

    Sep 17 19:01:01 d run-parts(/etc/cron.hourly)[8452]: finished 0anacronSep 17 19:10:01 d CROND[9059]: ...

  3. linux crontab定时执行

    #利用crontab定时执行url研究了两种简单方式#一利用lynx访问url yum install lynxservice crond startcrontab -einsert键* * * * ...

  4. Linux crontab定时执行任务 命令格式与详细例子

    基本格式 : * * * * * command 分 时 日 月 周 命令 第1列表示分钟1-59 每分钟用*或者 */1表示 第2列表示小时1-23(0表示0点) 第3列表示日期1-31 第4列表示 ...

  5. crontab定时执行任务

    第一部分 crontab介绍 每个操作系统都有它的自动定时启动程序的功能,Windows有它的任务计划,而Linux对应的功能是crontab. crontab简介 crontab命令常见于Unix和 ...

  6. Linux crontab定时执行任务命令格式与详细例子

    基本格式 : * * * * * command 分 时 日 月 周 命令 第1列表示分钟1-59 每分钟用*或者 */1表示 第2列表示小时1-23(0表示0点) 第3列表示日期1-31 第4列表示 ...

  7. mac上使用crontab周期性执行python脚本

    这个月买了本书<Linux系统命令及Shell脚本实践指南>, 看到了一个周期性执行任务cron.顿时产生一个想法: mac上有这种机制么? 加上自己也在15年下半年也学了点python脚 ...

  8. 在测试crontab执行脚本的时候,修改了linux的系统时间,crontab不执行了。

    今天在写服务器的perl脚本的时候,在完成一版脚本打算通过crontab来测试一下呢,因为直接执行脚本文件是没有问题的,但是当配置到crontab定期执行时就会出现问题,到了指定的时间了,但是脚本文件 ...

  9. linux下使用crontab定时执行脚本

    使用crontab定时执行脚本 cron服务是一个定时执行的服务,可以通过crontab 命令添加或者编辑需要定时执行的任务: crontab –e : 修改 crontab 文件,如果文件不存在会自 ...

随机推荐

  1. ubuntu 'Unable to correct problems, you have held broken packages' 错误

    在用apt 安装软件时,有时会用国内的源以加快下载速度. 但是在使用ubuntu 14.04的过程中,这一过程可能会导致错误“Unable to correct problems, you have ...

  2. mysql source导入报错ERROR 1366的解决方法

    文件是utf8的,数据库表是utf8的,为什么客户端导入会报错呢? 发现客户端用的是gbk的 改为utf8后正常 SHOW VARIABLES LIKE 'character%'; +-------- ...

  3. Nginx启动报错: could not open error log file: open() &q

    启动nginx报如下错误: nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error ...

  4. ubuntu文本模式/终端中文乱码解决

    ubuntu文本模式/终端中文乱码解决 1.Alt+Ctrl+F1 进入第一个终端tty1,发现中文乱码. 2.安装zhcon. sudo apt-get install zhcon3 输入下面命令, ...

  5. LR自定义函数以及调用

    2.2.自定义函数以及调用 2.2.1.虚拟用户编程,使用C# 语言DLL 在VS中建立DLL类库项目,编写函数时使用public声明:实现函数后编译生成DLL: 在LR中建立 .Net Vuser脚 ...

  6. 线程操作UI界面的方法

    以前一般都是用BeginInvoke来刷新UI界面,现在采用 SynchronizationContext 来刷新,写起来清楚多了. SynchronizationContext synchroniz ...

  7. linux命令行下载jdk

      官网JDK7下载地址 http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html 在里面 ...

  8. RabbitMQ消息队列1: Detailed Introduction 详细介绍

    1. 历史 RabbitMQ是一个由erlang开发的AMQP(Advanced Message Queue )的开源实现.AMQP 的出现其实也是应了广大人民群众的需求,虽然在同步消息通讯的世界里有 ...

  9. CListBox多选情况处理方法

        如ListBox的内容如下,蓝色代表选中的内容 列表  索引  删除时索引  item1 0  0  item2 1  0  item3 2    item4 3  1 删除所有选中列: vo ...

  10. Peterson算法

    #define FALSE 0 #define TRUE 1 #define N 2 /*进程数量 */ int turn; /* 现在轮到谁 */ int interested[N]; /*所有值初 ...