Created
August 13, 2020 07:10
-
-
Save MrHassanMurtaza/9358750c33f6340360b0aa003ffebbca to your computer and use it in GitHub Desktop.
Log bash output in containers
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/sh | |
log_message() | |
{ | |
MSG=$@ | |
LOGTIMESTAMP=`date "+%Y-%m-%d-%H:%M:%S"` | |
LOG_MSG="${LOGTIMESTAMP} Back-up from container $(hostname): ${MSG}" | |
echo "${LOG_MSG}" | |
} | |
log_message "INFO: This is test log" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment