docker: hourly prune of objects older than 7 days, root mail only when the prune fails
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user