Skip to content

Instantly share code, notes, and snippets.

@ultramookie
Last active March 20, 2024 03:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ultramookie/dcca2aac9d8acc737894573022d22df9 to your computer and use it in GitHub Desktop.
Save ultramookie/dcca2aac9d8acc737894573022d22df9 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# A little Mastodon hygeine. Keeping the storage nice and tidy.
# Get to where the script needs to go
cd /home/mastodon/live/bin
# Clean out accounts that have never interacted with anyone on this instance.
RAILS_ENV=production /home/mastodon/live/bin/tootctl accounts prune
# Clean out locally cached copies of avatars and headers. Headers can take up a LOT of space.
RAILS_ENV=production /home/mastodon/live/bin/tootctl media remove --days 14 --prune-profiles
# Clean up old media if it's not caught by the built in cleaning.
RAILS_ENV=production /home/mastodon/live/bin/tootctl media remove --days 14
# Clean up preview cards for links in posts.
RAILS_ENV=production /home/mastodon/live/bin/tootctl preview_cards remove --days 14
# Clean up all those things that have no parents (poor things :( ).
RAILS_ENV=production /home/mastodon/live/bin/tootctl media remove-orphans
# Removes statuses that nobody on your instance has interacted with.
# That's in contrast to the content retention settings which delete
# everything regardless if a user interacted with the post or not.
# h/t @BeAware@social.beaware.live for this tip.
RAILS_ENV=production /home/mastodon/live/bin/tootctl statuses remove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment