Collection-Scripts/clean_mailcow-backup.sh

12 lines
339 B
Bash
Executable File

# clean_mailcow-backup.sh
#!/bin/bash
# Use your health check url
HEALTHCHECK_URL="https://healthchecks.io/ping/{uuid}"
curl --retry 3 "$HEALTHCHECK_URL/start" || exit 1
find /root/s3_backup/mailcow/ -mindepth 1 -maxdepth 1 -type d -print0 | sort -z | head -zn-5 | xargs -0 rm -rf || exit 1
curl --retry 3 "$HEALTHCHECK_URL" || exit 1