Poor Man’s Auto Update

Chris Bensen
Oracle Developers
Published in
2 min readJun 28, 2022

by Chris Bensen

Photo by Miguel Á. Padriñán: https://www.pexels.com/photo/close-up-shot-of-keys-on-a-red-surface-2882668/

Back in the good old days GitHub allowed anonymous downloads. Now it requires username/password or ssh key. That’s no good when the Pi is out of your control. Thus, introducing the Chris Bensen Poor Man’s Auto Update. Whatever you do, do not do this at home, I am a professional and understand the security vulnerabilities.

The scenario is this: you have a script that runs on your Raspberry Pi and you need to update it. Let’s assume your script is setup to run on boot as a chron job. You can read about setting up a chron job on a Raspberry Pi here.


  1. Create the local directory structure on the Pi where ‘file.py’ is your script.
├── repo
│ ├── file.py
├── file.py
├── updater.py

2. Copy this bash script.


#!/bin/bashcurl -X GET \
<UrlToFile> \
-o file.py
if cmp -s “$file1” “$file2”; then
# same, do nothing
echo “same”
# different
echo “different”
cp $file1 $file2

3. Create a Oracle Cloud Object Store bucket.
4. Make that bucket public.
5. Copy your file to the bucket.
6. Edit the script by changing the <UrlToFile>. Get the URL from the Object Details and remove the file name from the end so you just have the following parts of the URL: {accountRestEndpointURL}/{containerName}/{objectName}
7. Edit the script so the paths are correct.
8. Setup a chron job to run `updater.py` as often as you want to check for updates. Every 5 minutes might be overkill but let’s start with that. You can read about setting up a chron job on a Raspberry Pi here.

You can read the documentation about the downloading a file from Object Store here.


The file updater/repo/file.py is the one that gets copied down. The script then compares it to the one in the updater directory. If they are different the updater directory is updated with the new one. updater/file.py is the one you want a symlink pointed to.

The reboot in updater.py will reboot the Pi which starts the updated file.py script. I know this is not the absolute best way to do this but it works and is fairly foolproof.

So there you have it, a poor man’s auto update.


Now I do know with OCI Object Store you can use an API for a pre-authenticated request. If you use a REST call from the Pi, you can keep the Object Store Private. However, that is additional work and I’m going to leave that for an excersise for the user, or a future post!

Meanwhile, you can chat about this on our public Slack, or sign up for Free Tier and try it yourself.



Chris Bensen
Oracle Developers

I make stuff. Creator of the Worlds Largest Raspberry Pi Cluster and Lego Computer.