linux定时重启节约内存

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>&1htm

 

参考:blog

一、http://www.cnblogs.com/shengulong/p/6763688.htmlcrontab

相关文章
相关标签/搜索