1
0
Fork 1

Update pull-logs.sh

This commit is contained in:
colin 2024-09-28 12:14:20 -04:00
parent 30f50dcb0f
commit 188ace0943
1 changed files with 11 additions and 1 deletions

View File

@ -12,10 +12,20 @@ TARGET_DATE=$1
TARGET_TIME=$2
RANGE=$3
# Combine date and time for start and end times
# Combine date and time for start and end times in ISO 8601 format
START=$(date -d "$TARGET_DATE $TARGET_TIME - $RANGE minutes" +"%Y-%m-%d %H:%M:%S")
END=$(date -d "$TARGET_DATE $TARGET_TIME + $RANGE minutes" +"%Y-%m-%d %H:%M:%S")
# Debugging output to ensure correct start and end times
echo "START: $START"
echo "END: $END"
# Ensure that START is before END
if [[ $(date -d "$START" +%s) -ge $(date -d "$END" +%s) ]]; then
echo "Error: START time is greater than or equal to END time."
exit 1
fi
echo "Collecting logs from $START to $END"
# Function to check journalctl logs