Simple Raspberry Pi Backup

So you have set up your Raspberry Pi as a home server and everything works as intended. But what if the SD card fails and all the data you stored on your Raspberry Pi is suddenly lost forever?

All storage devices containing important data need to be backed up on a regular basis. And this is even more true for SD cards than for most other storage media. Because unlike hard drives and SSDs, SD cards are not really made for installing operating systems on them and they are also not designed for being powered on 24/7. Therefore, SD cards have a comparatively high risk of failing.

One thing is for sure: Your new Raspberry Pi needs a backup solution!

Wouldn’t it be nice if you just had a little Python script on your Linux PC that whenever executed logged on the Raspberry Pi via SSH, fetched all your data, and put it into a new timestamped subdirectory?

This is actually much easier than you might think. So let’s dive into this problem!

Continue reading “Simple Raspberry Pi Backup”

Terminate a hanging Docker Container automatically

Let’s say you have a docker container that you run periodically, and it runs fine most of the time, but in some rare cases, it hangs. This can be very annoying, and it might take some time to find the root cause of the problem.

In the meantime, it would be great if the container would be terminated automatically after exceeding a user-defined maximum runtime.

To solve this problem, you can use the following Python script (don’t forget to change image_name and max_minutes to your environment):

Continue reading “Terminate a hanging Docker Container automatically”