crond需要重启么?

今天一同事说把A机器的/var/spool/cron/admin scp到B机器上的/var/spool/cron/目录下,有时不生效,需要restart crond.

经过实际验证,发现此现象描述不对。为了查明现象,又看了一下cron 的manual page,有这么一段描述:

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.

因为直接把A机器的/var/spool/cron/admin scp到B机器上的/var/spool/cron目录下,B机器的/var/spool/cron目录modtime肯定会改变.大家知道此目录下的任何文件内容变动都会导致目录的modtime改变。 change time意味着文件属性的变动时间, modification time意味着文件内容的变动时间,如果内容发生变动,change time也会变动。

猜你喜欢

转载自boisterous.iteye.com/blog/1076061