[script] output current ip address to virtual usb as file
Posted: Sun Aug 20, 2017 9:11 pm
if your TV is configured with DHCP to get its IP-address you have to look i your DHCP-Servers lease table to find the current IP of it.
the following init script creates an empty mp3 file in your virtual usb drive whose name is the current IP
ToDo: deal with IPv6
the following init script creates an empty mp3 file in your virtual usb drive whose name is the current IP
Code: Select all
# cat /mtd_rwcommon/SamyGO/etc/init.d/99_98_touch_my_ip.init
SpoilerShow
Code: Select all
#!/bin/busybox sh
#
#
. /dtv/SGO.env
case $1 in
start)
IP=`ifconfig eth0 |grep inet |cut -c -36`
IP=`echo $IP |sed -e 's/ /_/g'`
IP=`echo $IP |sed -e 's/:/_/g'`
touch $MOUNT_PATH/debug/$IP.mp3
;;
stop)
rm -r $MOUNT_PATH/debug
;;
restart)
$0 stop && $0 start || exit 1
;;
status)
ls -l $MOUNT_PATH/debug
;;
*)
echo "Usage: $0 {start|stop|restart|status}" 1>&2
exit 0
;;
esac