Sunday, 23 December 2012

Sending remote commands to our Pi thanks to Pastebin

I don't really know what this could be useful for, but I had the idea a couple of days ago of needing to send a command to my Pi system while being at work but have no direct access to it or nor the ip, or maybe the Pi is behind a firewall/NAT so I won't connect to it even with the IP.

So I thougth, what about a script that checks a page which I can acces from anywhere, downloads a file with the commands, executes them and sends me the result?

At first I thougth of doing this with my own server. Pretty easy, you upload to your server a file, let's call it commands.txt, and via cron the RPi checks to see if the file exists, downloads, executes, saves the output to the file and then reuploads it.

But there is a problem with this. I don't have a server. I had a VPS which expired a couple of weeks ago so I had to improvise.


Tracking our Pi System status in Cosm is a service that allows you to push data to it or it retrieves data from a device/app/cat and will make some incredible nice graphs with it:

They have a nice API and they accept XML, JSON and CSV to update out data.

So it's a nice platform to control and build graphs for our Raspberry Pi system. With it we can control and track how our system behaves along time without accesing the device.