davfs2 all on the same host.
davfs2 is used to mount what Apache is serving to the local filesystem - a sort of loopback. The purpose is that the content of the files served is dynamic and comes from a postgres database via php. In this case the file is an email footer/disclaimer that changes periodically and is read by the mail program.
This mostly works well, but when I try to
cp a file from the dav directory to another part of the filesystem, it
cp does not seem to trigger the 'has the file changed' check in davfs2 - it just gets the cached copy. Note the php file has not changed, only the dynamic content because something has been updated in the database.
On the other hand, if I
cp again 5 seconds later, the correct file contents is copied. I've ended up with a script like this:
#!/bin/bash cp /root/pgdav/disclaimer.html /etc/postfix/disclaimer.html sleep 5 cp /root/pgdav/disclaimer.html /etc/postfix/disclaimer.html
Caching related headers in php are set as follows:
header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache");
file_refresh 0 in
My question is: Is there some other setting I am missing to correct this behaviour?