So the post about how to run Plex Home Theater on a Chromebox proved to be very popular. The Chromebox has the perfect balance of power and affordability that makes it a stand out product. One question that popped up often is how does one update this system as newer builds come out. Since the Plex version is a modified form of OpenELEC, the built-in updating mechanism doesn't work. At the time, my answer was that it needed to be done manually. Luckily, that is no longer the case.
I have whipped up a quick python script that checks for updates and applies them automatically. This guide will explain how to install the script and schedule it to run on a regular basis.
For those wondering, this process will apply to any system running OpenELEC + Plex, not just the Chromebox. It does install the Generic builds of OpenELEC however, so if you require a particular build, you will need to make some minor tweaks to the python script.
Installing the script
The first thing we need to do is make sure that SSH is enabled on the OpenELEC. From the Plex interface, navigate to the left and select System Settings. Under the Services section, make sure Enable SSH is enabled and that Disable SSH Password is disabled. (If you don't see an Enable SSH option, that means it is enabled and you are all set). While you're at it, make sure Enable Cron is enabled (by default it is).
Now download putty if you don't already have it. We will be connecting to the OpenELEC box via SSH, so enter the IP address of it in the Host Name field in the PuTTY configuration window. All other default values are fine, so press Open. If you don't know what the IP address of your OpenELEC box is, go back to it and check the Connections section of the System Settings.
Login as root with the password openelec. If all goes well, you will be greeted with this:
Now download the script by running the following command:
We now need to set it up to run on a schedule, so enter the command:
This will open a text editor which will likely be blank. The formatting of a cron job is in this format:
* * * * * command to be executed | | | | | | | | | +----- day of week (0 - 6) (Sunday=0) | | | +--------- month (1 - 12) | | +------------- day of month (1 - 31) | +----------------- hour (0 - 23) +--------------------- min (0 - 59)
You now need to pick out a schedule of how often and when this script will run. Feel free to have this trigger as often as you want since it will only download the update if its new. In other words, the script is smart enough not to download the same version over and over again. With that said, it does require a reboot to apply an update, so you will probably want to schedule the update late at night to prevent it from running while someone is using the system.
I personally have mine update at 4:30 AM every Wednesday morning since I'm fairly certain no one would be up at that ungodly hour. Using the cron format, this works out to be 30 4 * * 3. The command we want to execute is python /storage/update.py. So I enter this into the blank document:
30 4 * * 3 python /storage/update.py
When you have your job entered in with a schedule that works for you, press Ctrl+X to exit. It will prompt you to save, press y. It will ask for a file name but one will already entered, simply press Enter.
If you're paranoid and want to make sure it was scheduled, enter this command:
The script is now all set and will run at the scheduled times.
Testing it out
Now let's give the script a test spin to make sure it runs as expected. In putty, type this command:
The first time the script is run, it will execute the update process even if you are on the newest version so that you can verify it works. Subsequent runs will stop if there is not a new update. You should see status messages like the ones below:
Just in case someone is using Plex while the update runs, they will see a warning pop up:
After the reboot, you will see this while it updates (which should only take a few seconds):
If you happen to run it again, you will see this message since you are on the latest version:
Your system is now up to date, and will stay that way! One less thing to worry about is always a good thing.