This file contains hidden or 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 | |
| usage="Input piped docker-compose logs -t, or a file created from this command, to show logs lines sorted by time.\n\n Usage:\n\n $(basename "$0") [-h|--help] - this message\n $(basename "$0") - runs default docker-compose logs -t and sorts'em\n docker-compose logs -t|$(basename "$0") - pipe logs to this command\n $(basename "$0") my-compose.log - or choose file with logs to display\n\n" | |
| [ $# -ge 1 -a -f "$1" ] && input="$1" || input="-" | |
| case "$1" in | |
| -h|--help) printf "$usage" | |
| exit | |
| ;; | |
| esac | |
| if [ -t 0 ]; then |
This file contains hidden or 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 | |
| case $1 in | |
| backup) | |
| docker run --rm -v $2:/volume -v $(pwd):/backup ubuntu tar cvf /backup/$2.tar /volume | |
| ;; | |
| restore) | |
| docker run --rm -v $(pwd):/backup -v $2:/volume ubuntu bash -c "cd /volume && tar xvf /backup/$2.tar --strip 1" |