在服务器上运行 crontab -e编辑定时任务 结果提示 command not found命令找不到,这就说明没安装crontab

由于

完整操作如下:

[root@iZ11pvsxisqZ /]# yum install vixie-cron crontabs
Loaded plugins: security
Setting up Install Process
Package cronie-1.4.-.el6_7..x86_64 already installed and latest version
Package crontabs-1.10-.el6.noarch already installed and latest version
Nothing to do
[root@iZ11pvsxisqZ /]# crontab -l
no crontab for root
[root@iZ11pvsxisqZ /]# service crond status
crond is stopped
[root@iZ11pvsxisqZ /]# service crond start
Starting crond: [ OK ]
[root@iZ11pvsxisqZ /]# ntsysv
[root@iZ11pvsxisqZ /]# chkconfig –level crond on
chkconfig version 1.3.49.3 - Copyright (C) - Red Hat, Inc.
This may be freely redistributed under the terms of the GNU Public License. usage: chkconfig [--list] [--type <type>] [name]
chkconfig --add <name>
chkconfig --del <name>
chkconfig --override <name>
chkconfig [--level <levels>] [--type <type>] <name> <on|off|reset|resetpriorities>
[root@iZ11pvsxisqZ /]# crontab -e
no crontab for root - using an empty one
crontab: no changes made to crontab

分步操作为

开始安装 运行

yum install vixie-cron crontabs

然后它返回很多

Loaded plugins: security
base
epel
epel/primary_db
extras
updates
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package cronie.x86_64 :1.4.-.el6_7. will be installed
--> Processing Dependency: dailyjobs for package: cronie-1.4.-.el6_7..x86_64
--> Processing Dependency: /usr/sbin/sendmail for package: cronie-1.4.-.el6_7..x86_64
--> Running transaction check
---> Package cronie-anacron.x86_64 :1.4.-.el6_7. will be installed
--> Processing Dependency: crontabs for package: cronie-anacron-1.4.-.el6_7..x86_64
---> Package exim.x86_64 :4.84.-.el6 will be installed
--> Running transaction check
---> Package crontabs.noarch :1.10-.el6 will be installed
--> Finished Dependency Resolution Dependencies Resolved ====================================================================================================================================================================
Package Arch Version
====================================================================================================================================================================
Installing:
cronie x86_64 1.4.-.el6_7.
Installing for dependencies:
cronie-anacron x86_64 1.4.-.el6_7.
crontabs noarch 1.10-.el6
exim x86_64 4.84.-.el6 Transaction Summary
====================================================================================================================================================================
Install Package(s) Total download size: 1.4 M
Installed size: 4.2 M
Downloading Packages:
(/): cronie-1.4.-.el6_7..x86_64.rpm
(/): cronie-anacron-1.4.-.el6_7..x86_64.rpm
(/): crontabs-1.10-.el6.noarch.rpm
(/): exim-4.84.-.el6.x86_64.rpm
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : exim-4.84.-.el6.x86_64
Installing : cronie-1.4.-.el6_7..x86_64
Installing : crontabs-1.10-.el6.noarch
Installing : cronie-anacron-1.4.-.el6_7..x86_64
Verifying : crontabs-1.10-.el6.noarch
Verifying : cronie-1.4.-.el6_7..x86_64
Verifying : exim-4.84.-.el6.x86_64
Verifying : cronie-anacron-1.4.-.el6_7..x86_64 Installed:
cronie.x86_64 :1.4.-.el6_7. Dependency Installed:
cronie-anacron.x86_64 :1.4.-.el6_7. crontabs.noarch :1.10-.el6 Complete!

然后我运行 crontab -l

提示 no crontab for root

然后我查看crontab服务状态
service crond status
它提示 crond is stopped

然后我运行service crond start

它提示 Starting crond:                                            [  OK  ]

然后我查看开机启动项 ntsysv

然后界面是

然后我把这个服务加入开机服务中 chkconfig –level 35 crond on

然后它提示

[root@iZ11pvsxisqZ /]# chkconfig –level 35 crond on
chkconfig version 1.3.49.3 - Copyright (C) - Red Hat, Inc.
This may be freely redistributed under the terms of the GNU Public License. usage: chkconfig [--list] [--type <type>] [name]
chkconfig --add <name>
chkconfig --del <name>
chkconfig --override <name>
chkconfig [--level <levels>] [--type <type>] <name> <on|off|reset|resetpriorities>

然后我 crontab -e 就进入了定时任务的编辑界面中

crontab command not found的更多相关文章

  1. -bash: crontab: command not found(转)

    操作步骤 1. 确认crontab是否安装: 执行 crontab 命令如果报 command not found,就表明没有安装 2. 安装 crontab 执行 yum install -y vi ...

  2. How to use 'crontab' command on bitnami

    You can edit the cron file using the following command: $ sudo crontab -e You can add a new line lik ...

  3. 提示crontab command not found的解决方法

    操作步骤   1. 确认crontab是否安装:   执行 crontab 命令如果报 command not found,就表明没有安装   2. 安装 crontab   执行 yum insta ...

  4. bash: crontab: command not found

    操作步骤 1. 确认crontab是否安装: 执行 crontab 命令如果报 command not found,就表明没有安装 2. 安装 crontab 执行 yum install -y vi ...

  5. Crontab定时任务配置

    CRONTAB概念/介绍 crontab命令用于设置周期性被执行的指令.该命令从标准输入设备读取指令,并将其存放于“crontab”文件中,以供之后读取和执行. cron 系统调度进程. 可以使用它在 ...

  6. Linux 定时任务 Crontab命令 详解

    前言 crontab是Unix和Linux用于设置周期性被执行的指令,是互联网很常用的技术,很多任务都会设置在crontab循环执行,如果不使用crontab,那么任务就是常驻程序,这对你的程序要求比 ...

  7. linux系统的任务计划crontab使用详解

    linux系统的任务计划crontab使用详解 其实大部分系统管理工作都是通过定期自动执行某一个脚本来完成的,那么如何定期执行某一个脚本呢?这就要借助linux的cron功能了. 关于cron任务计划 ...

  8. linux shell 之 crontab(定时任务)详解

    1.定义: crontab命令常见于Unix和类Unix的操作系统之中,用于设置周期性被执行的指令.该命令从标准输入设备读取指令,并将其存放于“crontab”文件中,以供之后读取和执行.该词来源于希 ...

  9. 【转载】PHP使用1个crontab管理多个crontab任务

    转载来自: http://www.cnblogs.com/showker/archive/2013/09/01/3294279.html http://www.binarytides.com/php- ...

随机推荐

  1. php计算最后一次,第一次字符串出现位置

    strpos($str, n) 首次,n在str第一次出现位置, strrpos($str, n) 最后一次,n在str最后一次出现位置 strripos区分大小写

  2. php类的属性

    属性声明是由关键字 public,protected 或者 private 开头,后面跟一个普通的变量声明来组成.属性的变量可以设置初始化的默认值,默认值必须是常量. class Car { //定义 ...

  3. div+css3实现漂亮的多彩标签云,鼠标移动会有动画

    div+css3实现漂亮的多彩标签云,鼠标移动会有动画 点击运行效果 <style> .dict { margin: 20px 0;clear:both ;text-align:left; ...

  4. 详解 CSS 属性 - 伪类和伪元素的区别[转]

    首先,阅读 w3c 对两者的定义: CSS 伪类用于向某些选择器添加特殊的效果. CSS 伪元素用于将特殊的效果添加到某些选择器. 可以明确两点,第一两者都与选择器相关,第二就是添加一些“特殊”的效果 ...

  5. C语言-07其它相关

    预处理指令 /* 不带参数的宏定义 1.所有的预处理指令都是以#开头 2.预处理指令分3种 1> 宏定义 2> 条件编译 3> 文件包含 3.预处理指令在代码翻译成0和1之前执行 4 ...

  6. iBatis入手案例

    第一部分,iBatis组织架构分析 1.1 组织架构图 1.2 架构分析 DAO层上面,DAO类通过SqlMapConfig文件,来构建iBatis提供的SqlMapClient,SqlMapConf ...

  7. python多重继承:

    除了从一个父类继承外,Python允许从多个父类继承,称为多重继承. 多重继承的继承链就不是一棵树了,它像这样: class A(object): def __init__(self, a): pri ...

  8. bzoj 3858: Number Transformation 暴力

    3858: Number Transformation Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 82  Solved: 41[Submit][Sta ...

  9. Ubuntu配置apache

    http://blog.csdn.net/ljchlx/article/details/21978431 http://www.2cto.com/os/201110/107283.html

  10. Eclipse下设置github开发环境

    1.按照github上的指南配置(http://help.github.com/win-set-up-git/)基础的git环境. 2.在github上创建一个Repository. 3.在Eclip ...