Patch to start support for speedify logs in a specified location

for /usr/lib/speedifconf/run.sh The following change would support a /etc/config/speedifyconf uci setting to set a logging path. If you were able to add that to the speedify UI section.

kputland@VONWQG1QWGJ21 smoothwan  % scp -r root@172.17.17.2:/usr/lib/speedifyconf/run.sh .
run.sh                                        100% 7392     1.2MB/s   00:00    
kputland@VONWQG1QWGJ21 smoothwan  % scp -r root@172.17.17.2:/usr/lib/speedifyconf/run.sh.orig .
run.sh.orig                                   100% 7293   926.9KB/s   00:00    
kputland@VONWQG1QWGJ21 smoothwan  % diff -u run.sh.orig run.sh
--- run.sh.orig	2023-04-26 14:01:45.000000000 -0600
+++ run.sh	2023-04-26 14:01:41.000000000 -0600
@@ -14,7 +14,9 @@
 
    cd /usr/share/speedify || exit 1
    sh DisableRpFilter.sh
-   mkdir -p logs
+   LOGPATH=$(uci -q get speedifyconf.Setup.logpath)
+   LOGPATH=${LOGPATH:-logs}
+   mkdir -p ${LOGPATH}
 
    if [ $(uci get speedifyconf.Setup.killsw) == 1 ]; then
       ifdown wan
@@ -52,7 +54,7 @@
       uci commit dhcp
       ip tuntap add mode tun connectify0
       ip link set connectify0 mtu 14800 up
-      nice -n -20 capsh --drop=cap_sys_nice,cap_net_admin -- -c './speedify -d logs &'
+      nice -n -20 capsh --drop=cap_sys_nice,cap_net_admin -- -c "./speedify -d ${LOGPATH} &"
    else
       ifdown wan
       ifdown wan6
@@ -86,7 +88,7 @@
       uci commit network
       uci commit firewall
       uci commit dhcp
-      nice -n -20 capsh --drop=cap_sys_nice -- -c './speedify -d logs &'
+      nice -n -20 capsh --drop=cap_sys_nice -- -c "./speedify -d ${LOGPATH} &"
    fi
    ifup wan
    ifup wan6
@@ -231,4 +233,4 @@
     run_speedify
     echo "Running"
  fi
-fi
\ No newline at end of file
+fi

Looks great! Feel free to do PR.
Thanks.

1 Like