Archive

Archive for the ‘Twitter Buttler’ Category

Waking up the computer at the office with your cell phone

January 29th, 2010 Pedro Pombeiro No comments
… And saving on utility bills while you’re at it! What I’m about to show you is a way to wake up your machine remotely with nothing more than a Twitter client and a small utility running on one of the machines at your office/campus.

 

Abridged version :-)

To get the utility that allows you to wake up a machine from a Twitter direct message, you need to go to the project’s home page at CodePlex. The source code is also available.

 

 

The problem…

Back in 2004, when it started becoming practical to use Remote Desktop to access my office machine, I started taking advantage of that to get more stuff done from home. Unfortunately, that required leaving the office machine turned on the whole time, 24/7, as I never knew when I might need to access it again. As you can imagine, this is terribly inefficient energetically (although arguably efficient in economic terms, as you could reason that the work done from home more than pays for the cost of the electricity bill).

Over the years, I have toyed with the idea of being able to remotely wake up my machine upon demand, leaving it in sleep mode or in hibernation mode during off-hours. I tried Wake-on-LAN, and although I could easily set it up within two machines in the office, our VPN box seemed to interfere with the communications required to wake up the machine. I needed a way to bypass the VPN…

 

My solution (and my first practical use for Twitter!)

Fast forward to 2010: with the advent of social networking platforms with open APIs, and the proliferation of free client software and libraries to access them, I now had all the tools I needed to quickly build a small mash up application that would sit on the server and react on Twitter direct messages. I started devising the requirements for such a tool:

  • Have low impact on the machine (no installation or 3rd party products to install);
  • Must be usable by everyone at the office, not just me;
  • Will take requests, and reply back once your machine is online. I immediately thought of Hanselman’s toy project, Tweet Sandwich. That was pretty much what I needed as far as the basic logic. However, instead of printing orders, my utility would run a piece of networking code that would take care of waking up a machine in the local network.

    How does it work?

    The simple answer is that you will be creating a file with an entry on each line for each machine you want to be able to wake up (normally one for each co-worker). Each line contains:

  • the Twitter screen name of the person;
  • the MAC address of the machine’s network card (you can type ipconfig /all at the Command Prompt to find out the address); and
  • the machine name or IP address.

When the utility app receives a special message from a given befriended Twitter account, it broadcasts a Magic Packet to the network, containing the MAC address of the specific machine, which will cause that machine to wake up. Twitter Buttler then checks whether the machine is now online and will fire back a Direct Message to the Twitter user letting him now that his machine is now turned on. At this point, the user can connect to his machine and carry on working.

Note: for you to be able to send direct messages to the utility app, the accounts listed in the config file need to follow the account used in Twitter Buttler, and vice-versa.

The are two commands you can currently send to Twitter Buttler: “wake up”, and “who’s online?”. They are pretty self-explanatory, so I won’t go into them here.

      Give it a try if you normally leave your office machine running for no good reason other than to be able to access it from home. Every little step counts in the quest to reduce our carbon footprint, and as the data suggests, there is quite a lot to be gained by just leaving our machines turned off.

     

     

    Shout it kick it on DotNetKicks.com