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