Add mastodon cleanup script

This commit is contained in:
Jake Howard 2023-01-29 19:46:47 +00:00
parent f063b09540
commit 5017b3ad78
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 28 additions and 0 deletions

View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -ex
cd /opt/mastodon
docker-compose exec mastodon tootctl media remove --days=7
docker-compose exec mastodon tootctl statuses remove --days=7
docker-compose exec mastodon tootctl preview_cards remove --days=7
docker-compose exec mastodon tootctl cache clear

View file

@ -18,3 +18,21 @@
validate: docker-compose -f %s config
notify: restart mastodon
become: true
- name: Install media cleanup script
template:
src: files/purge-media.sh
dest: /opt/mastodon/purge-media.sh
mode: "0755"
owner: "{{ docker_user.name }}"
become: true
- name: Schedule media cleanup
cron:
name: clean up mastodon media
hour: 2
minute: 0
weekday: 1
job: /opt/mastodon/purge-media.sh
user: "{{ docker_user.name }}"
become: true