Telnet access - jamesmacwhite/hh70-ee GitHub Wiki

A custom script called oem_start.sh is responsible for starting the key custom services mainly /usr/bin/core_app and /usr/bin/webs. In this script the value of the firmware env var of enable_telnet is checked. If it is set to 0, the telnet daemon is stopped. There is a short window where the telnet daemon may be active before this script stops the daemon process. You can set this env var to 1 to enable telnet permanently.

#! /bin/sh

. /sbin/mount_cache
. /sbin/mount_ipq

touch /tmp/enable_usb0_hotplug

[ -d /tmp/jrd_dir ] || mkdir /tmp/jrd_dir

export PATH=/ipq-resource/bin:$PATH
start-stop-daemon -S -b -a /usr/bin/core_app
env_telnet_enable=`fw_printenv enable_telnet|awk -F = '{print $2}'`
if [ "${env_telnet_enable}" == "0" ];then
  /etc/init.d/telnet stop 
fi
count=0
while [ $count -lt 60 ]
do
    if [ ! -f /jrd-resource/resource/force_mode  ];then
        break
    fi
    sleep 1
    count=$(($count+1))
done
start-stop-daemon -S -b -a /usr/bin/webs

while :
do
    sleep 5
    app_result=`ps|grep core_app|sed -e "/grep/d"|wc -l`
    webs_result=`ps|grep webs|sed -e "/grep/d"|wc -l`
    echo "app= $app_result"
    echo "webs=$webs_result"
    if [ "$app_result" -eq 0 ] || [ "$webs_result" -eq 0 ];then
        echo "app_result=$app_result ,webs_result=$webs_result" >> /dev/kmsg
        killall -9 core_app
        killall -9 webs
        start-stop-daemon -S -b -a /usr/bin/core_app
        sleep 3
        start-stop-daemon -S -b -a /usr/bin/webs
    fi
done

The enable_telnet environment variable can be set through fw_setenv with:

fw_setenv enable_telnet 1