Files
Ansible-roles/docker/files/docker-prune
T

13 lines
304 B
Bash

#!/bin/bash
# Silent on success: cron mails all output to root, so mail arrives only when the prune fails.
set -u
output=$(docker system prune -af --filter "until=168h" 2>&1)
rc=$?
if [ "$rc" -ne 0 ]; then
printf '%s\n' "$output"
echo "docker system prune exited with rc=$rc"
exit "$rc"
fi