updated killswitch
This commit is contained in:
13
collect.sh
13
collect.sh
@@ -6,21 +6,12 @@ greeting="Running perfcollect for $minutes minutes"
|
||||
echo "$greeting"
|
||||
echo "Will auto upload to iXsystem when completed."
|
||||
echo "Airgapped Systems will need to exfiltrate /root/*.csv"
|
||||
echo ""
|
||||
|
||||
python3 ./collect.zpool.iostat.py --minutes $minutes &
|
||||
|
||||
start_time=$(date +%s) # Get start time in seconds since epoch
|
||||
duration=$(($1/60)) # Set duration in seconds (here: 5 minutes)
|
||||
|
||||
echo "running gstat"
|
||||
gstat -C -s -d -o -p -I 60s > /root/gstat.csv & # Run the command in the background
|
||||
|
||||
while [[ $(($(date +%s) - $start_time)) -lt $duration ]]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "killing gstat"
|
||||
pkill gstat
|
||||
timeout "$minutes"m gstat -C -s -d -o -p -I 60s > /root/gstat.csv &
|
||||
|
||||
cp /root/zpool_iostat.csv /root/gstat.csv /var/log
|
||||
|
||||
|
||||
@@ -322,9 +322,7 @@ if __name__ == "__main__":
|
||||
args = parser.parse_args()
|
||||
TIMETORUN = args.minutes
|
||||
|
||||
print("Script started.")
|
||||
try:
|
||||
run_zpool_iostat(INTERVAL, COUNT, OUTPUT_FILE, UPDATE_INTERVAL, TIMETORUN)
|
||||
except Exception as e:
|
||||
print(f"An error occurred: {e}")
|
||||
print("Script ended.")
|
||||
|
||||
Reference in New Issue
Block a user