Skip to content

Commit c8ec860

Browse files
authored
xseed.sh v2.1.1 fix initial logging
don't tee if log file not yet ingested
1 parent cb7077d commit c8ec860

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

xseed.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,22 @@
88

99
# Load environment variables from .env file if it exists
1010
# in the same directory as this bash script
11-
VERSION='2.1.0'
11+
VERSION='2.1.1'
1212
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1313
ENV_PATH="$SCRIPT_DIR/.env"
1414

1515
# Function to log messages
1616
log_message() {
1717
local log_type="$1"
1818
local message="$2"
19-
echo "$(date '+%Y-%m-%d %H:%M:%S') [$log_type] $message" | tee -a "$LOG_FILE"
19+
local log_line="$(date '+%Y-%m-%d %H:%M:%S') [$log_type] $message"
20+
if [ -f "$LOG_FILE" ]; then
21+
echo "$log_line" | tee -a "$LOG_FILE"
22+
else
23+
echo "$log_line"
24+
fi
2025
}
26+
2127
log_message "INFO" "xseed.sh script started $VERSION"
2228
EVAR=false
2329
if [ -f "$ENV_PATH" ]; then

0 commit comments

Comments
 (0)