1. 确认crontab是否安装:
执行 crontab 命令如果报 command not found,就表明没有安装
2. 安装 crontab
安装过程如下
代码如下 | 复制代码 |
[root@10vps ~]# crontab -e -bash: crontab: command not found [root@10vps ~]# yum install -y vixie-cron Loaded plugins: fastestmirror, security Determining fastest mirrors * rpmforge: ftp.riken.jp base | 3.7 kB 00:00 extras | 3.4 kB 00:00 rpmforge | 1.9 kB 00:00 rpmforge/primary_db | 2.7 MB 00:02 updates | 3.4 kB 00:00 updates/primary_db | 3.2 MB 00:13 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package cronie.x86_64 0:1.4.4-12.el6 will be installed --> Processing Dependency: dailyjobs for package: cronie-1.4.4-12.el6.x86_64 --> Running transaction check ---> Package cronie-anacron.x86_64 0:1.4.4-12.el6 will be installed --> Processing Dependency: crontabs for package: cronie-anacron-1.4.4-12.el6.x86_64 --> Running transaction check ---> Package crontabs.noarch 0:1.10-33.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Transaction Summary Total download size: 114 k Installed: Dependency Installed: Complete! |
3. 确认是否安装成功:
代码如下 | 复制代码 |
执行 crontab -l |
4. 看是否设置了开机自动启动
代码如下 | 复制代码 |
chkconfig --list crond |
5. 启动crontab
代码如下 | 复制代码 |
service crond start |