mirror of
https://github.com/thetechprepper/emcomm-tools-os-community.git
synced 2026-09-17 15:41:44 -04:00
32 lines
589 B
Bash
Executable File
32 lines
589 B
Bash
Executable File
#!/usr/bin/bash
|
|
#
|
|
# Author : Gaston Gonzalez
|
|
# Date : 16 March 2024
|
|
# Updated : 9 October 2024
|
|
# Purpose : Log message to standard out and log file
|
|
|
|
ET_TEMP_DIR=/tmp/et
|
|
ET_LOG_FILE=$ET_TEMP_DIR/et.log
|
|
|
|
if [ ! -e $ET_TEMP_DIR ]; then
|
|
mkdir $ET_TEMP_DIR
|
|
chmod 755 $ET_TEMP_DIR
|
|
fi
|
|
|
|
if [ ! -e $ET_LOG_FILE ]; then
|
|
touch $ET_LOG_FILE
|
|
chmod 666 $ET_LOG_FILE
|
|
fi
|
|
|
|
if [ $# -lt 1 ]; then
|
|
echo "Usage $(basename $0) <msg>"
|
|
echo ""
|
|
echo "All messages written to: ${ET_LOG_FILE}"
|
|
exit -1
|
|
fi
|
|
|
|
TIMESTAMP=`date "+%Y-%m-%d %H:%M:%S"`
|
|
|
|
echo $@
|
|
echo "$TIMESTAMP $@" >> ${ET_LOG_FILE}
|