2010-11-25 116 views
0

我正在學習有關的cronjob,我發現這塊在一個項目中的代碼,從Twitter獲取記錄,任何人都可以告訴這個cronjob做什麼?

的代碼是這樣的:

#0 * * * * cp /vold/www/Abcd/log/twitter_feed_item_aggregator.log vold/www/Abcd/log/twitter_feed_item_aggregator.log.backup; > /vold/www/Abcd/log/twitter_feed_item_aggregator.log 

誰能解釋一下這段代碼呢?

回答

3

Hm ...每小時複製一次twitter agregator日誌,然後清除它。

這部分0 * * * *表示'每0分鐘'。分鐘0是新的一小時開始。

這部分cp /vold/www/Abcd/log/twitter_feed_item_aggregator.log vold/www/Abcd/log/twitter_feed_item_aggregator.log.backup顯然將日誌複製到備份。

這部分> /vold/www/Abcd/log/twitter_feed_item_aggregator.log輸出輸出沒有命令的文件,從而清除它。

+0

謝謝我如何刪除此cronjob,如果我鍵入crontab -r它也將刪除所有其他工作,但我只想刪除此cronjob – sharath 2010-11-25 07:34:27

+1

crontab -e編輯crontab(並註釋掉#用#指出道格拉斯或簡單地刪除線)。好的做法是先用crontab -l> crontab.backup備份crontab -l> crontab.backup,因爲如果系統在crontab後保存時系統磁盤空間不足,可能會丟失crontab -e – 2010-11-25 08:23:47

2

該行開頭的散列註釋掉該行,因此它什麼都不做。沒有它,它會像@playcat所說的那樣做。

相關問題