forked from colin/disk-space-report
Update pull-logs.sh
This commit is contained in:
parent
188ace0943
commit
1d41668fc8
16
pull-logs.sh
16
pull-logs.sh
|
@ -1,20 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Check if correct number of arguments are passed
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo "Usage: $0 <target-date> <target-time> <time-range>"
|
||||
echo "Example: $0 2024-09-28 11:35 5"
|
||||
echo "The time range is in minutes."
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "Usage: $0 <start-time> <end-time>"
|
||||
echo "Example: $0 '2024-09-28 11:30:00' '2024-09-28 11:40:00'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TARGET_DATE=$1
|
||||
TARGET_TIME=$2
|
||||
RANGE=$3
|
||||
|
||||
# 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")
|
||||
START=$1
|
||||
END=$2
|
||||
|
||||
# Debugging output to ensure correct start and end times
|
||||
echo "START: $START"
|
||||
|
|
Loading…
Reference in New Issue