Automate a Telnet Session with One Command

The Telnet protocol might not be the newest thing on the block, however there is still some legacy network hardware that will only accept Telnet connections and not newer more secure SSH connections. Recently I bought an APC MasterSwitch unit, that allows me to remotely power on and power off my hardware, and I ran into a problem of automation. I wanted to be able to remotely reboot the server every night a little after 3 AM, but there was no schedule capability inside the software that shipped with the decade old unit. The MasterSwitch, however did come with a built-in telnet server that one can remotely access and power on and off each individual outlet.

The problem with automating Telnet, is that the prompts are not always uniform between different Telnet servers as they are with SSH servers. So one needs to know the exact keystrokes used in order to accomplish the task they need to do. However if you know all of the keystrokes you can create a command that will type them directly to the telnet client on an *nix computer. Here is my crontab command that navigates through the menus of the MasterSwitch unit and reboots the selected outlet at 3:16 in the morning:


16 3 * * * { echo "USERNAME"; echo "PASSWORD"; echo "1"; echo "2"; echo "1"; echo "6"; echo "YES"; sleep 1; } | telnet SERVERNAME

You’ll see that this command reads sequential to the actual keys that I put in when accessing the unit, first my username, then my password, then the menu commands which use numbers to drill down to the actual outlet, and then confirm that you would like to reboot it. The sleep 1 command at the end spaces them out so that they don’t overload the client.

There you have it, a quick and dirty way to automate a telnet session!

ReverseHosts is Offering a Pretty Nice Deal: 512 MB VPS for $12/year

Wanted to pass this along to anyone looking to set up their own virtual server. ReverseHosts has a very nice deal right now on 512MB VPS servers – only $12 a year! For those of you looking to run online experiments, this is a great way to get started if you’re tech savvy enough to run your own server. If not, they also offer web hosting plans which will set up all the nuts and bolts for you (i.e. Apache, MySQL, etc…). I’ve been using ReverseHosts for about 7 months now and have found the team very responsive to issues, and the servers perform as advertised.

Use the coupon code WHT512ANNUAL to get the $12 a year price on either the SDVPS 512 or ATLVPS 512 (Depending on if you want your virtual server to be in the Atlanta or San Diego data center). Using my affiliate link also helps me out a bit (if you’re so inclined – costs you nothing).  Simply click the link, navigate to the order form, and choose either Open VPS Atlanta or Open VPS San Diego. Watch though – these deals tend to go fast.

Not Cruel, Freeing

A friend of mine joined the choir at her church awhile back. After a few months of stressing out over making sure she was always on time for each practice and recital, one of her fellow singers made an off-hand comment saying “We made due without you, we’ll be OK if you’re not here.

At first glance this seems a bit cruel. Our minds race through the iterations of the saying until we distill the message out: We don’t need you. We’re OK without you. You could fall off a cliff and we would just go on. Pretty mean. However once you realize what this statement actually brings with it, logically, you find it immensely freeing. Continue reading “Not Cruel, Freeing”

Building Your Own Personal Portable Netflix!

Imagine the scene. You’re traveling, staying in a hotel with really shaky Internet access (Or one with no Internet access) and loading Netflix or another video service of your choice isn’t going to happen. What do you do? Suck it up and watch commercial-laden cable while dreaming of your DVD collection at home? NO! You use Jon’s Personal Portable Netflix solution! For less than $100, you can take your DVD collection with you. Here’s how.

Portable Netflix

 

Continue reading “Building Your Own Personal Portable Netflix!”