From 23ab5a2371c78db6a5eadbc79bee6c41eeca395e Mon Sep 17 00:00:00 2001 From: Trey Blancher Date: Sat, 26 Aug 2023 09:17:08 -0400 Subject: [PATCH] Added user variable, and SSH_AGENT_PID --- psi-alerts.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/psi-alerts.sh b/psi-alerts.sh index 4362dfe..baaa8ea 100755 --- a/psi-alerts.sh +++ b/psi-alerts.sh @@ -42,6 +42,7 @@ svc="psi-monitor.service" cpu="/proc/pressure/cpu" mem="/proc/pressure/memory" io="/proc/pressure/io" +user="$(whoami)" host="$(hostname)" email_to="${EMAIL_TO}" sms_dst="${SMS_DST}" @@ -60,6 +61,8 @@ get_ssh_agent () { for dir in /tmp/ssh-*; do if [[ -O ${dir} ]]; then # only choose the last agent + export SSH_AGENT_PID=$(ps -eaf | grep ssh-agent | grep -v grep | \ + grep ${user} | awk '{print $2}') export SSH_AUTH_SOCK=$(ls ${dir}/agent.* | tail -1) fi done