Help on how to run this script at startup

I need help how to run this command at startup:

for FILE in /sys/class/net/*/queues/[rt]x-0/[rx]ps_cpus; do [ -w "$FILE" ] && echo 3 > "$FILE" 2>/dev/null; done

I do have this command now in System-Startup-Local Startup but it does not run

Thank you

Local Startup is just /etc/rc.local. A one-liner script won't work from there because there is no shell interpreter, it just launches commands.

I would rewrite this as regular script file and place it somewhere in the router filesystem (with execute permission set) then reference it from startup.

It might work to dispatch the code to sh like this: echo 'one-liner code' | sh

2 Likes

Another way to do this is to save the contents to a file in the init.d system.

1 Like

Thank you guys for your help. I'm very casual user of OpenWRT and would not know who to implement your suggestions. I'll run the command in ssh to test whatever performance it might or might offer and re-evaluate then.

Thank you

I finally, with @fantom-x help, got this to work. The solution is to save this:

#!/bin/sh

for FILE in /sys/class/net/*/queues/[rt]x-0/[rx]ps_cpus; do [ -w "$FILE" ] && echo 3 > "$FILE" 2>/dev/null; done

in a file, place it into /etc/hotplug.d/iface/, set it to 775 and done! The queues are set 3 as requested at boot

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.