I’d like to move the Syncthing binary on my Ubuntu 20.04 install to a place where the user has permissions to auto-update. I intend to move it to /var/www/bin (because it’s being run by www-data).
Do I just move the binary, or do I also need to create a symlink in the /usr/bin directory?
mv /usr/bin/syncthing /var/www/bin/
ln -s /var/www/bin/syncthing /usr/bin/
Edit: A couple of extra qs.
Do I need to modify any config?
I run Syncthing as a service: systemctl enable www-data@Syncthing.service. Do I need to alter this service?
Yes, you need to override the Systemd service unit file. This command should get you going, just change the path to the executable:
sudo systemctl edit email@example.com
The config does not care where the executable lives. I don’t see a reason why you should be touching
/usr/bin for this.
In my case, I didn’t have a systemd service file at that location, but systemctl status command gave me a clue that the service file was at the location below. after editing, I had to reload the daemon and then restart the service and check it was running:
systemctl start Syncthing@www-data.service
systemctl status Syncthing@www-data.service
D’oh! What a moron. I had installed it from the Syncthing repo with apt install. So the package manager presumably takes care of updates anyway, hence why the option in the GUI was disabled as “Unavailable/Disabled by administrator or maintainer”. So I probably needn’t have moved it in the first place. Rolling back my changes…
For the record,
systemctl edit is a little smarter. It finds the original file for a unit, lets you edit a copy and automatically puts your edits into an override file, leaving the original file untouched so it can continue to be managed by the packaging system. Finally, reloading the daemon is also taken care of automatically as needed. Pretty handy command overall.
Glad you found a solution. Using APT is definitely a good way to keep up to date.
strangely though when I enter
systemctl edit firstname.lastname@example.org
it doesn’t load the original file - just a blank screen to edit. I’m starting to think that running Syncthing as www-data in particular has some strange implications
Sorry I misremembered. There is the
systemctl edit --full mode, where you get to edit a copy of the unit file. The normal mode without
--full lets you edit a drop-in override file, which starts out empty. Use
systemctl cat syncthing@.service to find out which options are in there. Then copy and adjust the ones you need during
systemctl edit. I’m no systemd expert though, so don’t take it as an absolute thruth
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.