The Backup Shell Script for Photoprism and Immich

Reading Time: < 1 minute
When I go out to cycle, run, and do other things I take photos and when I come home I sync them to photoprism on one laptop and immich on a separate Raspberry Pi. I use photosync to sync to Photoprism.

Once images are ingested I usually run a script almost daily. Rather than give you the lines of shell script I’ll explain what it does. It checks that the photos SD card is mounted, as well as the backup drive before using rsync to synchronise between the primary and backup locations and then from the laptop running photoprism to the Pi running a second instance of Immich.

You might have noticed that I wrote “second instance”. The reason for having two of them is so that if one work flow has a problem I have the second as a backup. If photoprism and immich in one workflow fail then I have the backup immich instance. The final backup is via kDrive, from Infomaniak. That’s the offsite backup.

I check that the drives are mounted, and I ensure that rsync never deletes because if a drive isn’t mounted, if you’re not careful, then rsync will wipe a drive of its contents. That’s why I have the safety checks.

I also have the safety checks because sometimes the laptop reboots and mounts everything correctly, but other times it does not. Rebooting solves the problem.

The Shell script says that it can’t find the required mount points, and that’s when it is time to trouble shoot. It is usually quick to resolve, and resilient to data loss, so far.

The shell script works well, and I tweaked it once or twice, but this version is stable.