Created
February 16, 2021 15:48
-
-
Save wh13371/2b2012e89ed7ce3fe97e28c2fc5923f2 to your computer and use it in GitHub Desktop.
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 | |
_LOGFILE=/home/genesys/.@/$0.log | |
_NOW=$(date +"%Y-%m-%d %H:%M:%S.%6N") | |
_EPOCH=$(date +"%s.%6N") | |
_NOW_UTC=$(date --utc +%FT%T.%6N%Z) | |
_MSG="test message @ $_NOW_UTC" | |
_LOG="$(printf '{"timestamp": "%s", "epoch": "%s", "timestamp_utc": "%s", "message": "%s"}' "${_NOW}" "${_EPOCH}" "${_NOW_UTC}" "${_MSG}")" | |
echo "${_LOG}" | |
echo "${_LOG}" >> "${_LOGFILE}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment