Skip to content

Instantly share code, notes, and snippets.

@justdoit0823
Created June 1, 2018 08:12
Show Gist options
  • Save justdoit0823/24ce984a381f3b58cd1be19b464d60a0 to your computer and use it in GitHub Desktop.
Save justdoit0823/24ce984a381f3b58cd1be19b464d60a0 to your computer and use it in GitHub Desktop.
function show_haproxy_socket_info(){
ret=$(ss -tnlp|grep haproxy)
echo $ret
pstr=$(echo $ret | awk -F'\t' '{split($NF, a, ","); split(a[2], b, "="); split(a[3], c, "="); split(c[2], d, ")"); print b[2], d[1]}')
IFS=' '
read -r -a array <<< "$pstr"
pid="${array[0]}"
fd="${array[1]}"
stat /proc/$pid/fd/$fd
#lsof -p $pid |grep -v REG|grep -v DIR|grep -v ESTABLISHED
#lsof -p 3529 |grep -v REG|grep -v DIR|grep -v ESTABLISHED
#stat /proc/3529/fd/5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment