linux crontab -r 導致no crontab for root的原因及解決方案

來源:互聯網
上載者:User

標籤:blog   http   使用   ar   for   檔案   art   div   問題   

使用方式 :
crontab file [-u user]-用指定的檔案替代目前的crontab。
crontab-[-u user]-用標準輸入替代目前的crontab.
crontab-1[user]-列出使用者目前的crontab.
crontab-e[user]-編輯使用者目前的crontab.
crontab-d[user]-刪除使用者目前的crontab.
crontab-c dir- 指定crontab的目錄。
crontab檔案的格式:M H D m d cmd.
crontab -r : 刪除目前的時程表
crontab -l : 列出目前的時程表 s

使用crontab 

-r 是刪除目前使用者的時刻表,導致
crontab -l報錯 no crontab for root
解決方式是:給目前使用者添加計劃任務檔案 crontab -u root /var/log/


執行shell指令碼計劃任務的時候:
/bin/bash^M:bad interpreter: No such file or directory

該問題的解決方案是:由於該shell指令碼的文檔格式不對

查看shell文檔的文檔格式:set ff? 

設定shell文檔的文檔格式是:set ff=unix

linux crontab -r 導致no crontab for root的原因及解決方案

聯繫我們

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