This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
unix:networking:openwrt_routing [2014/08/14 06:34] ben [Transmission Update Script] |
unix:networking:openwrt_routing [2015/11/17 07:10] (current) ben [Transmission Update Script] |
||
|---|---|---|---|
| Line 83: | Line 83: | ||
| for host in $vpndhosts;do for server in $dnsservers;do ip rule add from $host to $server lookup main;ip rule add from $server to $host lookup main;done;done | for host in $vpndhosts;do for server in $dnsservers;do ip rule add from $host to $server lookup main;ip rule add from $server to $host lookup main;done;done | ||
| - | /opt/etc/scripts/port_forward_update.sh | + | /opt/etc/scripts/port_forward_update.sh & |
| </code> | </code> | ||
| Line 155: | Line 155: | ||
| #!/bin/sh | #!/bin/sh | ||
| echo $1 to $2 | echo $1 to $2 | ||
| - | ssh -i /opt/etc/pia/id_rsa root@nas cp /etc/transmission-daemon/settings.json /etc/transmission-daemon/settings.json.bak | + | transmissionhost=192.168.33.200 |
| - | ssh -i /opt/etc/pia/id_rsa root@nas "cat /etc/transmission-daemon/settings.json.bak | sed -e s#\:\ $1,#\:\ $2,#g > /etc/transmission-daemon/settings.json" | + | settingspath=/usr/local/transmission/var |
| - | ssh -i /opt/etc/pia/id_rsa root@nas killall -HUP transmission-daemon | + | settingsfile=$settingspath/settings.json |
| - | </code> | + | |
| - | <note important>Fix needed:</note> There's actually a logical flaw here- if the router goes down then the new port won't match and the sed match there will fail, not updating the port. | + | ssh -i /opt/etc/pia/id_rsa root@$transmissionhost cp $settingsfile $settingsfile.bak |
| + | #ssh -i /opt/etc/pia/id_rsa root@$transmissionhost ls -l $settingsfile $settingsfile.bak | ||
| + | ssh -i /opt/etc/pia/id_rsa root@$transmissionhost 'cat '"'$settingsfile.bak'"' | sed -e s#\ \ \ \"peer-port\"\:\ [0-9][0-9][0-9][0-9][0-9],#\ \ \ \"peer-port\"\:\ '"'$2'"',#g > '"'$settingsfile'"'' | ||
| + | ssh -i /opt/etc/pia/id_rsa root@$transmissionhost grep peer-port $settingsfile $settingsfile.bak | ||
| + | ssh -i /opt/etc/pia/id_rsa root@$transmissionhost killall -HUP transmission-daemon | ||
| + | </code> | ||
| ===== Scheduled port forward update ===== | ===== Scheduled port forward update ===== | ||