I've recently started using syncthing, and I've run into a challenge:
I have my home folder encrypted on my laptop, and I want to sync folders from inside my home-folder. The folder is encrypted using
ecryptfs (using the defaul Ubuntu "Do you want to encrypt your home-folder?" option), and, as far as I can tell it is mounted on log-in and unmounted on log-out.
So I cannot run syncthing as a boot-up service (f.ex. using supervisor).
It would need to start up on first login, and the last log-out process would have to send
SIGINT to the process, wait for it to shut down and then finish the log-out process.
I've been thinking about using
.bash_logout, but that seems finnicky to ensure it only runs on first and last logout. So I would opt-out of that.
Another option I had in mind was using
kdm (which I use to log-in to the WM. KDE in this case). But that would mean it would only run during graphical log-ins. That's okay though as I only use non-graphical log-ins to troubleshoot the system. Yet, I don't know how I would do that with
Maybe there's also an option to maybe write
udev triggers? But I doubt those can be used to properly shut-down syncthing as it would trigger after the device gets unmounted.
ecryptfs offers an option? But I can't find anything.
What would be the proper way to solve this? And how?