博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
crontab command not found
阅读量:5313 次
发布时间:2019-06-14

本文共 7777 字,大约阅读时间需要 25 分钟。

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

由于

完整操作如下:

[root@iZ11pvsxisqZ /]# yum install vixie-cron crontabsLoaded plugins: securitySetting up Install ProcessPackage cronie-1.4.4-15.el6_7.1.x86_64 already installed and latest versionPackage crontabs-1.10-33.el6.noarch already installed and latest versionNothing to do[root@iZ11pvsxisqZ /]# crontab -lno crontab for root[root@iZ11pvsxisqZ /]# service crond statuscrond is stopped[root@iZ11pvsxisqZ /]# service crond startStarting crond:                                            [  OK  ][root@iZ11pvsxisqZ /]# ntsysv[root@iZ11pvsxisqZ /]# chkconfig –level 35 crond onchkconfig version 1.3.49.3 - Copyright (C) 1997-2000 Red Hat, Inc.This may be freely redistributed under the terms of the GNU Public License.usage:   chkconfig [--list] [--type 
] [name] chkconfig --add
chkconfig --del
chkconfig --override
chkconfig [--level
] [--type
]
[root@iZ11pvsxisqZ /]# crontab -eno crontab for root - using an empty onecrontab: no changes made to crontab

分步操作为

开始安装 运行 

yum install vixie-cron crontabs

然后它返回很多

Loaded plugins: securitybase                                                                                                                                                                epel                                                                                                                                                                epel/primary_db                                                                                                                                                     extras                                                                                                                                                              updates                                                                                                                                                             Setting up Install ProcessResolving Dependencies--> Running transaction check---> Package cronie.x86_64 0:1.4.4-15.el6_7.1 will be installed--> Processing Dependency: dailyjobs for package: cronie-1.4.4-15.el6_7.1.x86_64--> Processing Dependency: /usr/sbin/sendmail for package: cronie-1.4.4-15.el6_7.1.x86_64--> Running transaction check---> Package cronie-anacron.x86_64 0:1.4.4-15.el6_7.1 will be installed--> Processing Dependency: crontabs for package: cronie-anacron-1.4.4-15.el6_7.1.x86_64---> Package exim.x86_64 0:4.84.2-3.el6 will be installed--> Running transaction check---> Package crontabs.noarch 0:1.10-33.el6 will be installed--> Finished Dependency ResolutionDependencies Resolved==================================================================================================================================================================== Package                                                              Arch                                                         Version                          ====================================================================================================================================================================Installing: cronie                                                               x86_64                                                       1.4.4-15.el6_7.1                 Installing for dependencies: cronie-anacron                                                       x86_64                                                       1.4.4-15.el6_7.1                  crontabs                                                             noarch                                                       1.10-33.el6                       exim                                                                 x86_64                                                       4.84.2-3.el6                     Transaction Summary====================================================================================================================================================================Install       4 Package(s)Total download size: 1.4 MInstalled size: 4.2 MDownloading Packages:(1/4): cronie-1.4.4-15.el6_7.1.x86_64.rpm                                                                                                                           (2/4): cronie-anacron-1.4.4-15.el6_7.1.x86_64.rpm                                                                                                                   (3/4): crontabs-1.10-33.el6.noarch.rpm                                                                                                                              (4/4): exim-4.84.2-3.el6.x86_64.rpm                                                                                                                                 --------------------------------------------------------------------------------------------------------------------------------------------------------------------Total                                                                                                                                                               Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction  Installing : exim-4.84.2-3.el6.x86_64                                                                                                                               Installing : cronie-1.4.4-15.el6_7.1.x86_64                                                                                                                         Installing : crontabs-1.10-33.el6.noarch                                                                                                                            Installing : cronie-anacron-1.4.4-15.el6_7.1.x86_64                                                                                                                 Verifying  : crontabs-1.10-33.el6.noarch                                                                                                                            Verifying  : cronie-1.4.4-15.el6_7.1.x86_64                                                                                                                         Verifying  : exim-4.84.2-3.el6.x86_64                                                                                                                               Verifying  : cronie-anacron-1.4.4-15.el6_7.1.x86_64                                                                                                               Installed:  cronie.x86_64 0:1.4.4-15.el6_7.1                                                                                                                                  Dependency Installed:  cronie-anacron.x86_64 0:1.4.4-15.el6_7.1                                                          crontabs.noarch 0:1.10-33.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 onchkconfig version 1.3.49.3 - Copyright (C) 1997-2000 Red Hat, Inc.This may be freely redistributed under the terms of the GNU Public License.usage:   chkconfig [--list] [--type 
] [name] chkconfig --add
chkconfig --del
chkconfig --override
chkconfig [--level
] [--type
]

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

转载于:https://www.cnblogs.com/lizhaoyao/p/5802291.html

你可能感兴趣的文章
浏览器的判断;
查看>>
ubuntu 18.04取消自动锁屏以及设置键盘快捷锁屏
查看>>
Leetcode 589. N-ary Tree Preorder Traversal
查看>>
机器学习/深度学习/其他开发环境搭建记录
查看>>
xml.exist() 实例演示
查看>>
判断是否为空然后赋值
查看>>
zabbix监控日志文件
查看>>
正则表达式
查看>>
pip install torch on windows, and the 'from torch._C import * ImportError: DLL load failed:' s...
查看>>
java基础(一):我对java的三个环境变量的简单理解和配置
查看>>
arcgis api 4.x for js 结合 Echarts4 实现散点图效果(附源码下载)
查看>>
YTU 2625: B 构造函数和析构函数
查看>>
apache自带压力测试工具ab的使用及解析
查看>>
C#使用Xamarin开发可移植移动应用(2.Xamarin.Forms布局,本篇很长,注意)附源码
查看>>
jenkins搭建
查看>>
C#中使用Split分隔字符串的技巧
查看>>
eclipse的调试方法的简单介绍
查看>>
加固linux
查看>>
IPSP问题
查看>>
10.17动手动脑
查看>>