linux定時任務提示-bash: crontab: command not found

來源:互聯網
上載者:User

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

================================================================================
 Package                Arch           Version               Repository    Size
================================================================================
Installing:
 cronie                 x86_64         1.4.4-12.el6          base          73 k
Installing for dependencies:
 cronie-anacron         x86_64         1.4.4-12.el6          base          30 k
 crontabs               noarch         1.10-33.el6           base          10 k

Transaction Summary
================================================================================
Install       3 Package(s)

Total download size: 114 k
Installed size: 220 k
Downloading Packages:
(1/3): cronie-1.4.4-12.el6.x86_64.rpm                    |  73 kB     00:00    
(2/3): cronie-anacron-1.4.4-12.el6.x86_64.rpm            |  30 kB     00:00    
(3/3): crontabs-1.10-33.el6.noarch.rpm                   |  10 kB     00:00    
--------------------------------------------------------------------------------
Total                                            15 kB/s | 114 kB     00:07    
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : cronie-1.4.4-12.el6.x86_64                                   1/3
  Installing : crontabs-1.10-33.el6.noarch                                  2/3
  Installing : cronie-anacron-1.4.4-12.el6.x86_64                           3/3
  Verifying  : crontabs-1.10-33.el6.noarch                                  1/3
  Verifying  : cronie-anacron-1.4.4-12.el6.x86_64                           2/3
  Verifying  : cronie-1.4.4-12.el6.x86_64                                   3/3

Installed:
  cronie.x86_64 0:1.4.4-12.el6                                                 

Dependency Installed:
  cronie-anacron.x86_64 0:1.4.4-12.el6       crontabs.noarch 0:1.10-33.el6     

Complete!
[root@10vps ~]# crontab -l
no crontab for root

3. 確認是否安裝成功:

 代碼如下 複製代碼

執行 crontab -l

4. 看是否設定了開機自動啟動

 代碼如下 複製代碼

chkconfig --list crond

5. 啟動crontab

 代碼如下 複製代碼

service crond start

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.