Created
December 14, 2021 21:14
-
-
Save crayzeigh/b1ef6102d84d4a0795066221ed4b4bdb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
email="you@domain.com" | |
body="Start: $(date) | |
Checking for new images... | |
$(/bin/docker-compose -f /path/to/docker-compose.yml pull --no-parallel 2>&1) | |
Updating changed containers... | |
$(/bin/docker-compose -f /path/to/docker-compose.yml up -d 2>&1) | |
Cleaning up... | |
$(/bin/docker system prune -af 2>&1) | |
End $(date) | |
" | |
# Only receive emails if an image changed | |
if [[ ${body} == *"Recreating"* ]]; then | |
echo "${body}" | mail -s "Docker Updates Completed" ${email} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment