1
mirror of https://github.com/jakejarvis/mastodon-utils.git synced 2025-04-26 04:35:21 -04:00
mastodon-utils/scripts/weekly_cleanup.sh
2022-12-20 15:51:37 -05:00

23 lines
654 B
Bash
Executable File

#!/bin/bash
# cronjob ran once per week at 3 AM on Sunday; see https://crontab.guru/#0_3_*_*_0
# syntax for crontab -e:
# 0 3 * * 0 bash -c "/home/mastodon/utils/scripts/weekly_cleanup.sh >> /home/mastodon/logs/cron.log 2>&1"
# exit when any step fails
set -euo pipefail
echo -e "\n===== weekly_cleanup.sh: started at $(date '+%Y-%m-%d %H:%M:%S') =====\n"
# initialize path
. "$(dirname "$(realpath "$0")")"/../init.sh
if [ ! -d "$LOGS_ROOT" ]; then
as_mastodon mkdir -p "$LOGS_ROOT"
fi
tootctl media remove --days 7
tootctl preview_cards remove --days 90
echo -e "\n===== weekly_cleanup.sh: finished at $(date '+%Y-%m-%d %H:%M:%S') =====\n"