How to properly rescan STOPPED folders? (on portainer after reboot, manually restarting syncthing container fixes issue)

tl;dr: I’d like to know how to automatically either 1) restart Syncthing, or 2) rescan folders just as if synchting was restarted, when folders are marker as “STOPPED”. I think there are some timing issues with the mounting of my folders and the starting of Syncthing.

I’m using the linuxserver/syncthing docker image via portainer. I’m no expert in containerization, but my setup seems to work perfectly fine. I’ve been using Syncthing for years and everything is as expected (e.g. permissions are alright).

My only issue is that after a system reboot, all folders in synchting are “STOPPED” and I get the “folder path missing” error for each. If I run a command line in the container (using portainer), I can verify that I can actually read/write/execute files in the folders.

I can fix this issue by simply restarting the Synchting container, hence why I think that it’s an issue of timing between the mounting of my backup volume and the starting of Syncthing.

I’d like this situation to be fixed automatically so that I don’t have to restart Syncthing manually after each reboot. Rescanning the folders seems to do nothing even though I did check that read/write/execute works fine in the container.

This is a synchronisation and backup server (I know Syncthing isn’t a backup plan, another tool does the backups) and as such forgetting to restart Syncthing could be very bad; I’d like this to be a set it and forget it kind of deal.

Any help is welcome!

PS: thanks for all of your work. Syncthing is really a joy to use and among my favorite softwares.

1 Like

Of course, right after posting this online, I found a fix. And as one might expect, Syncthing wasn’t the culprit. I’ll leave my solution here in case it could help others in the future.

To fix the issue, I just delayed the start of Docker by 30 seconds by running sudo systemctl edit docker.service and adding

ExecStartPre=/bin/sleep 30

to to the service file.

Thanks again for you hard work!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.