Turris Omnia: Shellskripte

Diese Shellskripte sind zwar für Turris OS geschrieben, sollten aber unter anderen OpenWRT basierten Systemen ebenfalls lauffähig sein.

Alle konfigurierten DHCP Hosts auflisten

list-hosts.sh
#!/bin/sh . /lib/functions.sh show_host() { config_get host "$1" 'name' config_get ip "$1" 'ip' config_get mac "$1" 'mac' if [ "x$mac" != "x" ]; then echo -e "$mac $ip\t$host" fi } config_load dhcp config_foreach show_host 'host'

MAC-Adresse für konfigurierten DHCP Host anzeigen

list-hosts.sh
#!/bin/sh . /lib/functions.sh show_mac_if_host_match() { config_get host "$1" 'name' if [ "x$2" = "x$host" ]; then config_get mac "$1" 'mac' echo "$mac" fi } config_load dhcp host=$1 mac=$(config_foreach show_mac_if_host_match 'host' $host) if [ "x$mac" != "x" ]; then echo host $host has mac $mac; else echo $host not found; fi