SSH_AGENT_PID remove superfluous grep, added print_psi to send()
This commit is contained in:
		@@ -61,7 +61,7 @@ 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 | \
 | 
			
		||||
            export SSH_AGENT_PID=$(ps -eaf | grep '[s]sh-agent' | \
 | 
			
		||||
                                   grep ${user} | awk '{print $2}')
 | 
			
		||||
            export SSH_AUTH_SOCK=$(ls ${dir}/agent.* | tail -1)
 | 
			
		||||
        fi
 | 
			
		||||
@@ -186,11 +186,12 @@ send () {
 | 
			
		||||
        subj="PSI on ${host} ${psi_type} triggered!"
 | 
			
		||||
        current_alarms="${psi_type}"
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    print_psi "${psi_type}" >> ${email}
 | 
			
		||||
    printf "\n\n" >> ${email}
 | 
			
		||||
    # is this an email or SMS?
 | 
			
		||||
    if [[ ! "${dst}" =~ "@${sms_domain}" ]]; then
 | 
			
		||||
        for p in $(tr '|' ' ' <<< "${current_alarms}"); do
 | 
			
		||||
            printf "\nStatistics info for ${p}\n\n" >> ${email}
 | 
			
		||||
            printf "\n\nStatistics info for ${p}\n\n" >> ${email}
 | 
			
		||||
            print_stats "${p}" >> ${email}
 | 
			
		||||
            printf "\n\n" >> ${email}
 | 
			
		||||
        done
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user