When is "USB Script" executed?

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
flyingfishfinger
DD-WRT Novice


Joined: 26 Feb 2023
Posts: 31

PostPosted: Tue May 09, 2023 15:13    Post subject: When is "USB Script" executed? Reply with quote
Hi,
I'm having difficulty finding documentation on when the "USB Script" section of the Commands page is executed. What triggers it? Is it every time a USB device is detected / inserted? Once on startup when a device is first registered? Something else?

I put some commands there to execute a program which requires a USB device, but it seemingly doesn't get run.
I also tried putting the commands in the "Startup" script section, but I noticed the USB initialization takes ~ 20secs longer than the main boot so I'm not sure if the Startup section is already passed by the time the device appears.

If I log in via SSH and paste the exact same script post-boot, it runs fine.

(This isn't a script-specific question, more of a general "How does dd-wrt handle stuff in the Commands section?" issue)

Thanks,
R
Sponsor
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6407
Location: UK, London, just across the river..

PostPosted: Tue May 09, 2023 21:38    Post subject: Reply with quote
usb script is triggered when usb is ready..
i use it, only for commands that must be read/executed from the USB...it makes sense... Cool

you can add sleep command first, on the top of the USB script commands, so you know there is enough time before you triggered your commands:

sleep 20

you may need to fiddle with time, to make it work as you need...

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55179 WAP
TP-Link WR1043NDv2 -DD-WRT 55303 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55460 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55460 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55363 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1855
Location: Hung Hom, Hong Kong

PostPosted: Fri May 12, 2023 15:22    Post subject: Reply with quote
Alozaros wrote:
you can add sleep command first, on the top of the USB script commands, so you know there is enough time before you triggered your commands:

sleep 20

you may need to fiddle with time, to make it work as you need...

ANd there is also is-mounted.sh as another check.
Code:
# find / -name is-mounted.sh
./usr/bin/is-mounted.sh

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum