[script] output current ip address to virtual usb as file

Here are software that related with Samsung C series TVs, applications, programs that will run in your TV or computer...:!:This forum is NOT FOR USER QUESTIONS or Problems.
Post Reply

User avatar
beatfreak
SamyGO Project Donor
Posts: 582
Joined: Tue Aug 23, 2011 9:03 am
Location: Hamburg
Contact:

[script] output current ip address to virtual usb as file

Post by beatfreak » 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

Code: Select all

# cat /mtd_rwcommon/SamyGO/etc/init.d/99_98_touch_my_ip.init 

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
ToDo: deal with IPv6
Last edited by beatfreak on Fri Oct 27, 2017 5:52 pm, edited 3 times in total.
//UE40C6500 @ T-VALDEUC 3011 // rooted manual HotelMode style // PVR to NFS via 18MB on-the-fly sparse XFS //
FYI: you can close your ssh session with SamyGO with

Code: Select all

~.
If you can't fix it using dvct tape, you are not using enough dvct tape.