I think syncthing already adds itself as a systemd service, and systemd has an "AC power only condition."
I can take a closer look tomorrow, but here's a page about systemd's AC power condition: https://askubuntu.com/questions/654335/systemd-how-to-start-stop-services-on-battery
Edit: bah, the built-in AC power condition only checks once when it starts up, so you'll probably have to do the custom option that was selected as the answer in that post I linked to.
all 25 comments