I kept hitting an error when building solr `/bin/sh: /docker-entrypoint.sh: Text file busy`, this is caused where the script is attempted to be ran before the previous `chmod` command has properly sync'd to disk. Adding in a sync fixes this trouble for me.
Where there is a lot of folders in a mailbox the output may be larger
than TEXT will allow (64KiB). Instead use MEDIUMTEXT (16MiB) which
should be ample.
Additionally check that a sync isn't already running before starting
a new one.
Fixes: #1011