The fossil web interface provides a "Sync Now" option on the Admin page.  However, in order for this to work correctly, the following must all be true:

<ol>
<li>The running fossil serving the request must have a current directory within a "fossil open" checkout or exactly one repository must be specified on the command line (not a directory).  &#91;<font size="-1">It appears that a single-repository cgi script is no longer good enough as the repository is closed by the time the process_sync_args function runs and since no repository name is available in the options list (it's embedded in the script instead) fossil fails to find the repository.</font>]

<li>The environment must have a HOME (or equivalent) variable set to a path that allows writing/creating both .fossil and .fossil-journal files.  &#91;<font size="-1">This may be a particularly challenging requirement to satisfy in a secure manner when the fossil cgi is running as the www user on a web server.  Although certainly using the command in the #! line of a fossil cgi script to set HOME then run fossil may be of some help here, but that seems clumsy.</font>]
</ol>

This breaks down if fossil was started with the "fossil server directory" option (or the corresponding fossil cgi "directory: ..." option).  Which repository will get sync'd when you select "Sync Now"?  In fact it looks like if the above conditions are true, you'll always sync the same repository which may or may not be related at all to the the repository being viewed via the web ui.

However, for the "fossil ui" command only, none of the above applies since a single repository must be specified and it's reasonable to expect the conditions listed above to always be satisfied correctly.

Is it possible to just suppress the "Sync Now" option unless the command that started the server was "fossil ui"?

P.S. Even when using "fossil ui" to run the "Sync Now" option (and it does work) the sync progress output corrupts the content being returned -- all the progress details from the sync are output before the initial "HTTP/1.0 200 OK" response so it's kind of surprising that the browser even displays the real html content correctly at all (after the mash of sync progress output at the top of the page).  It might be simpler just to get rid of the web interface to "Sync Now" completely.