Arduino Yun project 'TelnetLocalhost6571'

Arduino

Scetch: TelnetLocalhost6571

Projekt transferiert Linux script nach /usr/bin
um Kommando 'telnet localhost 6571' per 'tn' zu aktivieren.

TelnetLocalhost6571.ino

/*
 Project: TelnetLocalhost6571
 Author: Michael Gries
 Creation: 2014-07-27
 Modified: 2014-07-28
*/

/*
To see the Console, select your Yún's name and IP address in the Port menu. 
The Yún will only show up in the Ports menu if your computer is on the same LAN as the Yún. 
If your board is on a different network, you won't see it in the Ports menu. 
Open the Port Monitor. You'll be prompted for the Yún's password.
You can also see the Console by opening a terminal window and typing 

ssh root@yourYunsName.local 'telnet localhost 6571' 

then pressing enter.
 
NB: If you are using Windows, you must install a terminal emulator. 
PuTTY is a reasonable choice, but you will have to enter the two commands above separately.
*/


/*
 used Libraries:          http://arduino.cc/en/Guide/Libraries
 Bridge-Library           http://arduino.cc/en/Reference/YunBridgeLibrary
 Telnet-Reference         http://arduino.cc/en/Guide/ArduinoYun
*/

/*
Use sketch only to tranfer files under folder www to cd-card.
Then use PuTTY to run script 'runOnceTransferScript' to copy 'tn' file to appropriate /usr/bin folder.
Use this complete path to run script: /mnt/sda1/arduino/www/TelnetLocalhost6571/runOnceTransferScript
*/

#include 

#define PROGRAM "TelnetLocalhost6571" 
#define VERSION "14.7.28" 

void setup() {
  Bridge.begin();
  Console.begin(); 
  // Wait for Console port to connect
  while (!Console); 
  Console.println(">>>: Console active ...");
  Console.print(PROGRAM); Console.print(" ");  Console.println(VERSION);
  Console.println("Open ssh session and run script");
  Console.println("/mnt/sda1/arduino/www/TelnetLocalhost6571/runOnceTransferScript");
  Console.println("to copy script 'tn' to /usr/bin to shorten telnet service command");
  Console.println(">>>");
}

void loop() {
  char c;
  if (Console.available()) {
    c = Console.read();
    Console.write(c);
  }
} 

    

www/runOnceTransferScript

#/www/sd/TelnetLocalhost6571/runOnceTransferScript
#
cp tn /usr/bin
#
echo "file 'tn' copied to /usr/bin"
echo "run 'tn' only if Console is available"
echo ""
echo "2014-07-28, Michael Gries"
echo ""
    

www/tn

#/usr/bin
#
echo ""
echo "tn, 2014-07-28, Michael Gries"
echo ""
echo "running 'telnet localhost 6571' "
echo ""
#
telnet localhost 6571