diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-03-27 18:33:04 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-03-27 18:33:04 +0200 |
commit | 0b7be79bc1fe58c0c19c0c21b1200b098186432f (patch) | |
tree | 9da472df927a5a007d95ae8e14209101f32ced36 /scripts/ifup | |
parent | 156b2dc0656d63cd94b686245c67ff740017f3d9 (diff) |
add an example script for ifup/ifdown
Diffstat (limited to 'scripts/ifup')
-rwxr-xr-x | scripts/ifup | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/ifup b/scripts/ifup new file mode 100755 index 0000000..b62054c --- /dev/null +++ b/scripts/ifup @@ -0,0 +1,20 @@ +#!/bin/sh + +case "$0" in + *ifdown) mode=down;; + *ifup) mode=up;; + *) echo "Invalid command: $0";; +esac + +[[ "$1" == "-a" ]] && { + for interface in `ubus -S list 'network.interface.*'`; do + ubus call $interface $mode + done + exit +} + +ubus -S list "network.interface.$1" > /dev/null || { + echo "Interface $1 not found" + exit +} +ubus call "network.interface.$1" "$mode" |