Skip to content

Instantly share code, notes, and snippets.

@justdoit0823
Created October 16, 2022 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justdoit0823/04dfc7751f0e66633bc133db7e56c0de to your computer and use it in GitHub Desktop.
Save justdoit0823/04dfc7751f0e66633bc133db7e56c0de to your computer and use it in GitHub Desktop.
#!/bin/bash
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
}
show_haproxy_socket_info
service haproxy reload &
#show_haproxy_socket_info
#show_haproxy_socket_info
#show_haproxy_socket_info
#show_haproxy_socket_info
#show_haproxy_socket_info
ss -tnlep|grep haproxy
#ps aux|grep haproxy|awk '{pid=pid","$2} END {print pid}'|xargs lsof -p|grep LISTEN
ss -tnlep|grep haproxy
#ps aux|grep haproxy|awk '{pid=pid","$2} END {print pid}'|xargs lsof -p|grep LISTEN
ss -tnlep|grep haproxy
#ps aux|grep haproxy|awk '{pid=pid","$2} END {print pid}'|xargs lsof -p|grep LISTEN
ss -tnlep|grep haproxy
#ps aux|grep haproxy|awk '{pid=pid","$2} END {print pid}'|xargs lsof -p|grep LISTEN
ss -tnlep|grep haproxy
#ps aux|grep haproxy|awk '{pid=pid","$2} END {print pid}'|xargs lsof -p|grep LISTEN
show_haproxy_socket_info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment