Skip to content

Instantly share code, notes, and snippets.

@MrHassanMurtaza
Created August 13, 2020 07:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrHassanMurtaza/9358750c33f6340360b0aa003ffebbca to your computer and use it in GitHub Desktop.
Save MrHassanMurtaza/9358750c33f6340360b0aa003ffebbca to your computer and use it in GitHub Desktop.
Log bash output in containers
#!/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