Linux -bash: crontab: command not found錯誤解決辦法

來源:互聯網
上載者:User

操作步驟

1. 確認crontab是否安裝:

執行 crontab 命令如果報 command not found,就表明沒有安裝

2. 安裝 crontab

執行 yum install -y vixie-cron

3. 確認是否安裝成功:

執行 crontab -l

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

chkconfig --list crond

5. 啟動crontab

service crond start


如果安裝了還不能支援可能是許可權問題

指令碼寫的是否正確,shell指令碼是否擁有執行許可權。一切正常還不能執行的話,就用以下方法
使root使用者的crontab生效

crontab -u root /var/spool/cron/root

重啟crontab服務

service crond restart

 可能出現的錯誤

"cronfile1":2: premature EOF
errors in crontab file, can"t install.

在crontab檔案末尾增加一個空行就可解決此問題。

"/tmp/crontab.NINM91":1: bad day-of-week
errors in crontab file,can"t install

根據提示,是第一行的 周寫錯了
crontab -e儲存時,crond會檢測時間格式,如果時間格式不正確就會報錯errors in crontab file,can’t install,還是一個很人性化的設定。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.