As Tom says, you need to add thos two lines to the transmission-daemon.service file and enable transmission to run at system startup with sudo systemctl enable transmission-daemon
. Since transmission now requires openvpn, if the latter is stopped, transmission will also be stopped by systemd.
Binding to the VPN address isn’t strictly necessary but should give an extra level of assurance. Reading the script, it’s unclear which IP address you’re going to bind to, but AFAICT, it should be the one associated with tun0 (or whatever your tunnel is called).
From ifconfig:
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.1.1.41 P-t-P:10.1.1.41 Mask:255.255.0.0
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
In this case the IP address you’re interested in is 10.1.1.41. Unfortunately, it’s likely to change with each connection, so you’ll need to extract it and paste it into settings.json for each system startup.
I can foresee a few issues at startup, since openvpn will run before transmission, but will not know whether it’s able to issue the transmission. stop/start. I’d therefore recommend that you place a 5 second sleep in the [Service] section of the transmission-daemon.service file:
ExecStartPre=/bin/sleep 5
This will avoid the need for the stop/start when amending settings.json.
Edit: On reflection, I think that binding transmission to the VPN address is going to be more trouble than it’s worth. First, because connman still can’t deal with openvpn DNS push directives, you need to deal with them yourself. The only thing that I know of that works with OSMC is openresolv. (NB resolvconf should not be installed since it also installs the ifupdown package.) If you really do want to go down this path, I think the best way to update settings.json is via a shell script run from ExecStartPre
in transmission-daemon.service. Either keep the 5-second sleep or, better still, check periodically to see if tun0 is UP, then get the IP address.