forked from colin/disk-space-report
Update pull-logs.sh
This commit is contained in:
parent
30f50dcb0f
commit
188ace0943
12
pull-logs.sh
12
pull-logs.sh
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue