Show pagesourceOld revisionsBacklinksBack to top × Table of Contents Hotplug extras Introduction Features Implementation Instructions Examples Automated Hotplug extras This article relies on the following: Accessing OpenWrt CLI Managing configurations Managing packages Managing services Introduction This instruction extends Hotplug functionality. Follow Opkg extras to extend Opkg functionality. Follow UCI extras to extend UCI functionality. Follow the automated section for quick setup. Features Run scripts at startup when the network is online. Implementation Rely on network functions to identify WAN interface. Use Hotplug to detect WAN connectivity and trigger network dependent scripts. Delay script invocation with sleep to work around tunneled connections. Write and read non-interactive logs with Syslog for troubleshooting. Instructions # Configure hotplug mkdir -p /etc/hotplug.d/iface cat << "EOF" > /etc/hotplug.d/iface/90-online . /lib/functions/network.sh network_flush_cache network_find_wan NET_IF network_find_wan6 NET_IF6 if [ "${INTERFACE}" = "${NET_IF}" -o "${INTERFACE}" = "${NET_IF6}" ] \ && [ "${ACTION}" = "ifup" -o "${ACTION}" = "ifupdate" ] then for FILE in /etc/hotplug.d/online/* do . "${FILE}" 2>&1 done | logger -t hotplug-online fi EOF cat << "EOF" >> /etc/sysupgrade.conf /etc/hotplug.d/iface/90-online EOF mkdir -p /etc/hotplug.d/online cat << "EOF" > /etc/hotplug.d/online/30-sleep sleep 10 EOF cat << "EOF" >> /etc/sysupgrade.conf /etc/hotplug.d/online/30-sleep EOF Examples # Check hotplug log logread -e hotplug Automated opkg update opkg install libustream-mbedtls uclient-fetch -O hotplug-extras.sh "https://openwrt.org/_export/code/docs/guide-user/advanced/hotplug_extras?codeblock=0" . ./hotplug-extras.sh This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.OKMore information about cookies Last modified: 2021/04/13 02:14by vgaetera