Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:advanced:hotplug_extras [2021/03/16 01:32] – moved from hotplug_online vgaetera | docs:guide-user:advanced:hotplug_extras [2023/10/03 18:12] – [Instructions] avoid global delay, use delay per script if necessary vgaetera | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Hotplug extras ====== | ====== Hotplug extras ====== | ||
| - | {{section> | + | {{section> |
| ===== Introduction ===== | ===== Introduction ===== | ||
| - | * This instruction | + | * This instruction |
| + | * Follow the [[docs: | ||
| - | ===== Goals ===== | + | ===== Features |
| * Run scripts at startup when the network is online. | * Run scripts at startup when the network is online. | ||
| + | |||
| + | ===== Implementation ===== | ||
| + | * Use [[docs: | ||
| + | * Process subsystem-specific scripts with [[https:// | ||
| + | * Delay script invocation with [[man> | ||
| + | * Write and read non-interactive logs with [[docs: | ||
| ===== Instructions ===== | ===== Instructions ===== | ||
| Line 12: | Line 19: | ||
| # Configure hotplug | # Configure hotplug | ||
| mkdir -p / | mkdir -p / | ||
| - | cat << " | + | cat << " |
| - | . / | + | if [ " |
| - | network_flush_cache | + | then exit 0 |
| - | network_find_wan NET_IF | + | |
| - | network_find_wan6 NET_IF6 | + | |
| - | if [ " | + | |
| - | && [ " | + | |
| - | then for FILE in / | + | |
| - | do . " | + | |
| - | done | logger -t hotplug-online | + | |
| fi | fi | ||
| + | if [ " | ||
| + | && [ " | ||
| + | then exit 0 | ||
| + | fi | ||
| + | if [ " | ||
| + | && [ -z " | ||
| + | && [ -z " | ||
| + | then exit 0 | ||
| + | fi | ||
| + | hotplug-call online | ||
| EOF | EOF | ||
| cat << " | cat << " | ||
| - | / | + | / |
| + | EOF | ||
| + | </ | ||
| + | |||
| + | ===== Examples ===== | ||
| + | <code bash> | ||
| + | # Example script | ||
| + | cat << " | ||
| + | logger -t hotplug $(env) | ||
| EOF | EOF | ||
| + | / | ||
| + | logread -e hotplug | ||
| </ | </ | ||
| ===== Automated ===== | ===== Automated ===== | ||
| <code bash> | <code bash> | ||
| - | opkg update | + | wget -U "" |
| - | opkg install libustream-mbedtls | + | |
| - | uclient-fetch | + | |
| . ./ | . ./ | ||
| </ | </ | ||