Add mastodon.sh

This commit is contained in:
daniel committed 2026-10-14 05:00:46 +00:00
1 parent 55b62b1b95
commit ee582233fd
1 file changed
+41
+41
View File
@@ -0,0 +1,41 @@
#!/bin/bash
#written by Daniel Wenzlik 2024 - https://danielwenzlik.com
#Script under the GNU AGPLv3 license.
#using the correct directory
echo "Navigating to the Mastodon Directory now";
cd /home/mastodon/live/;
#deleting cache files
echo "Clearing cache";
RAILS_ENV=production /home/mastodon/live/bin/tootctl cache clear;
# Prune remote accounts that never interacted with a local user
echo "Prune local accounts";
RAILS_ENV=production /home/mastodon/live/bin/tootctl accounts prune;
# Remove remote statuses that local users never interacted with older than 1 day
echo "Remove remote statuses older than 1 day";
RAILS_ENV=production /home/mastodon/live/bin/tootctl statuses remove --days=1;
# Remove media attachments older than 1 day
echo "Remove media attachments older than 1 day";
RAILS_ENV=production /home/mastodon/live/bin/tootctl media remove --days=1;
# Remove all headers
echo "Remove all headers";
RAILS_ENV=production /home/mastodon/live/bin/tootctl media remove --remove-headers --include-follows --days=0;
# Remove link previews older than 1 day
echo "Remove link previews older than 1 day";
RAILS_ENV=production /home/mastodon/live/bin/tootctl preview_cards remove --days=1;
# Remove files not linked to any post
echo "Remove files not linked to any post";
RAILS_ENV=production /home/mastodon/live/bin/tootctl media remove-orphans;
#finishing script
echo "Done.";
exit 0;