Rory Toma-3 wrote: > > > Does anything touch the file, it checks mtime and ctime, and returns the > newest value to check? > > Also, is there a possibility that your time is being set during boot, > causing some confusion perhaps? (This does on ours, so we work around it) > >
Yes but in our case mtime, ctime and atime are all the same so it's not a problem. Here's a real case scenario so it's easier to understand. 1. Our deamon loads the IP configuration from our non volatile storage and modifies ifcfg.eth0 2. Monit sees it and start a configuration script $ cat /var/log/monit [ Apr 4 02:42:04] error : 'ifcfg.eth0' timestamp was changed for /etc/sysconfig/ifcfg.eth0 [ Apr 4 02:42:04] info : 'ifcfg.eth0' exec: /etc/sysconfig/network_script/ifupdate.sh 3. The script loads and cat the file with a timestamp so we can see the content of the file when it loaded. See the log file of the script. $ cat ifupdate_log [599 Apr 04 02:42:04]/etc/sysconfig/ifcfg.eth0 IFACE=1 [599 Apr 04 02:42:05]/etc/sysconfig/ifcfg.eth0 DEVICE=eth0 [599 Apr 04 02:42:05]/etc/sysconfig/ifcfg.eth0 MACADDRESS=00:50:CC:71:FF:E7 [599 Apr 04 02:42:05]/etc/sysconfig/ifcfg.eth0 ENABLE=no [599 Apr 04 02:42:05]/etc/sysconfig/ifcfg.eth0 VLANID=0 [599 Apr 04 02:42:05]/etc/sysconfig/ifcfg.eth0 BOOTPROTO=dhcp [599 Apr 04 02:42:06]/etc/sysconfig/ifcfg.eth0 RENEW=no [599 Apr 04 02:42:06]/etc/sysconfig/ifcfg.eth0 TYPE=Ethernet [599 Apr 04 02:42:06]/etc/sysconfig/ifcfg.eth0 IPADDR=172.16.246.246 [599 Apr 04 02:42:06]/etc/sysconfig/ifcfg.eth0 NETMASK=255.255.0.0 [599 Apr 04 02:42:07]/etc/sysconfig/ifcfg.eth0 GATEWAY=172.16.0.1 [599 Apr 04 02:42:07]/etc/sysconfig/ifcfg.eth0 ALWAYSREBIND=yes 4. Later on I see that I got the problem on my unit, I log on it and check the file content and the timestamp. See that ENABLE=yes here but the timestamp is the same 2013-04-04 02:42:04. So when I cat the file from the script at 02:42:04 ENABLE was set to "no" but later on it's set to yes but the timestamp is the same. $ cat ifcfg.eth0 IFACE=1 DEVICE=eth0 MACADDRESS=00:50:CC:71:FF:E7 ENABLE=yes VLANID=0 BOOTPROTO=dhcp RENEW=no TYPE=Ethernet IPADDR=172.16.246.246 NETMASK=255.255.0.0 GATEWAY=172.16.0.1 ALWAYSREBIND=yes $ stat ifcfg.eth0 File: "ifcfg.eth0" Size: 185 Blocks: 8 IO Block: 4096 regular file Device: ch/12d Inode: 341 Links: 1 Access: (0777/-rwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2013-04-04 02:42:04.000000000 Modify: 2013-04-04 02:42:04.000000000 Change: 2013-04-04 02:42:04.000000000 -- View this message in context: http://old.nabble.com/Monit-spawning-script-before-the-filesystem-is-updated-tp35284127p35301309.html Sent from the monit-general mailing list archive at Nabble.com. -- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
