Skip to main content

Auto Update Downloaded Ollama Models

Published 1 min readMarkdown
Part of seriesHow-to
Auto Update Downloaded Ollama Models

I like to keep all models updated, but Ollama does not automatically update downloaded models. This is how I automate updates using a cronjob and Bash script.

~/.local/bin/update-models.sh

#!/usr/bin/env bash

# Update all local models.
models=$(ollama ls | tail -n +2 | awk '{print $1}')

for model in $models
do
    echo "Pulling ${model}"
    ollama pull $model
done

Run it after 12 AM daily. I introduced delay execution in this blog post.

0    0    *    *    *    sleep $((RANDOM % 3600)); ~/.local/bin/update-models.sh > /dev/null 2>&1

About the author

  • I work with Linux in the day, ballroom dancing at night. I use Arch, btw.

No comments yet. Be the first to comment.

More from this blog