Mastodon 清理站外数据,核心是使用 tootctl 工具在 web 或 sidekiq 容器中执行命令,清理缓存的媒体、预览卡片、旧帖与无效账号。以下是完整、可直接复制的命令与方案。

admin7天前 64

# 进入目录
cd /path/to/mastodon

# 1. 清理 7 天远程媒体 + 头像
docker-compose run --rm web tootctl media remove --days 7 --prune-profiles

# 2. 清理 30 天预览卡片
docker-compose run --rm web tootctl preview_cards remove --days 30

# 3. 清理 14 天无互动站外嘟文
docker-compose run --rm web tootctl statuses remove --days 14

# 4. 清理失效远程账号
docker-compose run --rm web tootctl accounts cull

# 5. 清理孤立文件
docker-compose run --rm web tootctl media remove-orphans

设置定时清理任务

# 编辑定时任务
crontab -e

# 每天凌晨 2 点执行清理(示例)
0 2 * * * cd /path/to/mastodon && docker-compose run --rm web tootctl media remove --days 7
0 2 * * * cd /path/to/mastodon && docker-compose run --rm web tootctl preview_cards remove --days 30
0 3 * * * cd /path/to/mastodon && docker-compose run --rm web tootctl statuses remove --days 14
0 4 * * * cd /path/to/mastodon && docker-compose run --rm web tootctl accounts cull

重新拉取站外头像和资料

docker exec -it mastodon-web-1 bin/tootctl accounts refresh --all

测试连通性:测试连通性https://你的域名/.well-known/webfinger?resource=acct:用户@你的域名

本文链接:https://www.sweetly.cn/thread-113.htm
转载请注明:7天前 于 一起微笑的博客 发表
推荐阅读
最新回复 (0)
    返回