This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TOP=$(journalctl -u endlessh.service | grep "time=" | awk '{split($11, time, "="); split($8, ip, ":"); print ip[4], time[2]}' | awk '{arr[$1]+=$2} END {for (i in arr) {print i,arr[i]}}' | sort -n -k2) | |
format_duration() { | |
local seconds=$(printf "%.3f" $1) # Convert seconds to 3 decimal places | |
local milliseconds=$(echo "scale=0; $seconds * 1000" | bc) # Convert seconds to milliseconds | |
local milliseconds=${milliseconds%.*} # Remove decimal part | |
# Calculate days, hours, minutes, and seconds |