最近LH想做一个脚本统一管理的工具,因为crontab里面的东西太多了而且乱,就牵扯到一个cron是怎么加载的问题.我们知道的是通过crontab -e修改crontab后,这个任务会自动被安装上,但是如果直接修改crontab文件呢?man cron后,
Additionally, cron checks each minute to see if its spool directory’s modtime (or the modtime on /etc/crontab) has changed, and if it has, cron will then examine the modtime on all crontabs and reload those which have changed. Thus cron need not be restarted whenever a crontab file is modified. Note that the crontab(1) command updates the modtime of the spool directory whenever it changes a crontab.
明白了,cron会一分钟加载一次如果目录的modtime改变的话.因为crontab的精度就是分钟,所以这下放心了,怎么改都行了不用担心cron会不重新加载了.