If you’re an avid user of the open-source image library Photoprism, you know how convenient and powerful it can be for managing and organizing your photo collection. However, keeping your library indexed and up to date manually can be a tedious task. Thankfully, with a simple cronjob in Linux, you can automate the indexing process and ensure your Photoprism library stays current without any manual intervention.

Indexing with Cron

  1. Create the shell-script auto_index.sh
1
2
3
set -o allexport; source /opt/photoprism/config/.env; set +o allexport
cd /opt/photoprism/bin/
./photoprism index
  1. Make it executable using chmod -x auto_index.sh
  2. Add it to your crontabs using crontabs -e
1
2
#Run Photoprism indexing every day
@daily /opt/photoprism/photoprism index

In this example, the cronjob is scheduled to run every day at 0:00 AM, triggering the Photoprism indexing process by invoking the index command.