linux服務器上運行的一些程序,比較消耗內存,須要定時重啓,進行內存按期釋放php
0 2 * * * sudo /sbin/reboot && echo $(date) '重啓成功' >> ~/reboot_log.loghtml
上面這種寫法,日誌是不會寫入reboot_log.log的linux
crontab -u root -e服務器
0 2 * * * echo $(date) '重啓成功' >> ~/reboot_log.log && /sbin/rebootspa
天天凌晨2點0分重啓設備,並把重啓的時間和「重啓成功」寫入用戶目錄下reboot_log.log文件裏日誌
把信息寫到一個日期變化的文件裏code
0 12 * * * php /Users/fdipzone/test.php >> "/Users/fdipzone/$(date +"\%Y-\%m-\%d").log" 2>&1
htm
參考:blog
一、http://www.cnblogs.com/shengulong/p/6763688.htmlcrontab