Created
February 21, 2019 19:07
-
-
Save ThomasLeister/aa1c500eedeff19551f3bb8238533854 to your computer and use it in GitHub Desktop.
How to automatically remove cached media files older that 7 days from your Mastodon instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
SHELL=/bin/bash | |
PATH=/home/mastodon/.rbenv/shims:/home/mastodon/.rbenv/bin:/usr/local/bin:/usr/bin:/bin | |
### | |
### Mastodon cronjobs for media cache purging | |
### | |
RAILS_ENV=production | |
@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). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you're running Mastodon in a docker container, run
docker exec -it mastodon_web_1 tootctl media remove --days=7