一、
crontab例行检查:如果是自己开发的程序,打开文件需要绝对路径或者chdir来改变当前工作目录。
用getcwd来获取当前工作目录。
二、日志滚动
先用执行命令:
[root@local cron.daily]# /usr/sbin/logrotate -f /etc/logrotate.conf
error: error accessing /var/log/conman: No such file or directory
error: conman:5 glob failed for /var/log/conman/*
如果出现上述错误就手动建立相应的目录或文件
直到没有报错为止
三、添加到crontab中
[root@local cron.daily]#crontab -e
0 0 * * * /usr/sbin/logrotate -f /etc/logrotate.conf
四、重启服务
/etc/init.d/crond restart