Control a Raspberry Pi from your phone

Raspberry Pi Cluster

Part of the utility of the Raspberry Pi and other 'Nix systems is that they can be set up headlessly (no monitor, keyboard or mouse) on a network and configured remotely using SSH. No need for a GUI like Raspbian, just a lightweight CLI (Command Line Interface) serving up whatever services you like. Simple. Powerful.

I have RasPis running a web server, music file server, security cameras and - the only one with a screen - a music streamer. Several of these services could be running from the same Raspberry Pi or you could run each one as a discrete entity.

Various tasks can be automated through the use of simple-but-powerful shell scripts and automated via a cron schedule. For instance my security cameras report (via email) their running temperatures and I have another RasPi which monitors and reports daily on UPS performance.

On occasion I might need to run a task on-demand and I don't always want to have to SSH into the box to make it happen. For instance when I was developing the security cameras I sometimes needed to be able to remotely reboot them or to check on their current temperatures when I made changes to the camera cases.

SSH Button How handy would it be to be able to run such tasks at the press of a button on your smart phone!? Enter SSH Button. Available through Google Store, developer David Grootendorst has come up with an approach whereby, as the name implies, each button on the app corresponds to a shell script sitting on the RasPi - or any other 'Nix box for that matter.

The target system will require SSH to be working and you will need the ability to create, often quite simple shell scripts. For example a basic reboot script - /home/andym/ could contain the following line:

sudo reboot

Make sure it works by running it first from an SSH login. Then open the SSH Button app on your smart phone, press the three little dots in the top right hand corner and select Add.. The Label field is the button label, Command must include the full path to the script name on the target system, Hostname is the target system's IP address and SSH Username/password are your usual SSH login details. There is some provision for private key management if you want and SSH Port is the default 22 unless you've got something different.

Click the OK button and the new SSH button appears in the list. Give it a press and watch the magic happen. There are similar apps, but I find SSH Button reliable and easy to use and it does everything I need.

Compare this to the inconvenience of trying to fiddle with a tiny touchscreen GUI or even worse, using an android device as a Raspberry Pi screen..

AndyM | July 2020