Skip to content

Instantly share code, notes, and snippets.

Created February 21, 2019 19:07
  • Star 22 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
How to automatically remove cached media files older that 7 days from your Mastodon instance
This is how to automatically delete cached image previews from your Mastodon instance if they are older than 7 days.
Log in as your "mastodon" User or log in as root and then change to the "mastodon" user, who runs Mastodon:
# su - mastodon
Open crontab:
$ crontab -e
... and add these lines to your crontab:
### Mastodon cronjobs for media cache purging
@daily cd /home/mastodon/live && bin/tootctl media remove
Edit the editor. The new Cron Job will be accepted.
This script assumes that your Mastodon Sourcecode lives in /home/mastodon/live (as suggested by the official setup guide).
Copy link

If you're running Mastodon in a docker container, run docker exec -it mastodon_web_1 tootctl media remove --days=7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment