mastodon-app/cleanup.sh

40 lines
998 B
Bash
Raw Permalink Normal View History

2020-08-16 08:30:44 +00:00
#!/bin/bash
set -eu
echo "=> Cleanup"
2020-08-16 08:30:44 +00:00
cd /app/code
2023-04-26 11:04:46 +00:00
if [[ ! -f /app/data/cache-env.sh ]]; then
2023-04-26 11:13:05 +00:00
echo "==> Creating initial cache-env.sh"
2023-04-26 11:04:46 +00:00
cp /app/pkg/cache-env.sh.template /app/data/cache-env.sh
fi
source /app/data/cache-env.sh
2023-04-26 11:13:05 +00:00
echo "=> Retention days set to ${CACHE_RETENTION_DAYS}"
echo "==> media cache ..."
2023-04-26 11:04:46 +00:00
./bin/tootctl media remove --days=${CACHE_RETENTION_DAYS}
echo "==> orphaned media ..."
./bin/tootctl media remove-orphans
2023-04-26 11:04:46 +00:00
echo "==> preview cards ..."
./bin/tootctl preview-cards remove --days=${CACHE_RETENTION_DAYS}
echo "==> prune profiles ..."
./bin/tootctl media remove --prune-profiles --days=${CACHE_RETENTION_DAYS}
echo "==> remove headers ..."
./bin/tootctl media remove --remove-headers --days=${CACHE_RETENTION_DAYS}
2023-05-13 11:33:03 +00:00
echo "==> clear cache ..."
/app/code/bin/tootctl cache clear
echo "==> remove unreferenced statuses ..."
/app/code/bin/tootctl statuses remove --days=${CACHE_RETENTION_DAYS}
2023-05-13 16:22:52 +00:00
echo "==> prune accounts ..."
/app/code/bin/tootctl accounts prune