Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:advanced:hotplug_extras [2021/10/14 13:00] – [Examples] 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 extends [[docs: | + | * This instruction extends |
| * Follow the [[docs: | * Follow the [[docs: | ||
| Line 10: | Line 10: | ||
| ===== Implementation ===== | ===== Implementation ===== | ||
| - | | + | * Use [[docs: |
| - | | + | |
| * Process subsystem-specific scripts with [[https:// | * Process subsystem-specific scripts with [[https:// | ||
| * Delay script invocation with [[man> | * Delay script invocation with [[man> | ||
| Line 21: | Line 20: | ||
| mkdir -p / | mkdir -p / | ||
| cat << " | cat << " | ||
| - | . / | + | if [ " |
| - | network_flush_cache | + | |
| - | network_find_wan NET_IF | + | |
| - | network_find_wan6 NET_IF6 | + | |
| - | if [ " | + | |
| - | && [ " | + | |
| then exit 0 | then exit 0 | ||
| fi | fi | ||
| Line 42: | Line 36: | ||
| cat << " | cat << " | ||
| / | / | ||
| - | EOF | ||
| - | mkdir -p / | ||
| - | cat << " | ||
| - | sleep 10 | ||
| - | EOF | ||
| - | cat << " | ||
| - | / | ||
| EOF | EOF | ||
| </ | </ | ||
| Line 54: | Line 41: | ||
| ===== Examples ===== | ===== Examples ===== | ||
| <code bash> | <code bash> | ||
| - | # Test | + | # Example script |
| - | cat << " | + | cat << " |
| - | nslookup openwrt.org 2>&1 \ | + | logger -t hotplug $(env) |
| - | | logger -t online-check | + | |
| EOF | EOF | ||
| - | reboot | + | / |
| - | + | logread -e hotplug | |
| - | # Check | + | |
| - | logread -e online | + | |
| </ | </ | ||
| ===== Automated ===== | ===== Automated ===== | ||
| <code bash> | <code bash> | ||
| - | alias uclient-fetch="uclient-fetch --no-check-certificate" | + | wget -U "" |
| - | uclient-fetch | + | |
| . ./ | . ./ | ||
| </ | </ | ||