Re: alert mail send (101 Views)
Reply
Super Advisor
rajesh73
Posts: 431
Registered: ‎03-17-2009
Message 1 of 2 (107 Views)

alert mail send

we need to send the alert mail,  when license down

 

normal license working

 

$tail -1 /home/raj/lic.txt

20 license in use

 

when license not working

$tail -1 /home/raj/lic.txt

unable to connect

 

i need to send the mail where the lic.txt file output comes unable to connect that time we need to send the mail

 

please share the procedure

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,774
Registered: ‎03-06-2006
Message 2 of 2 (101 Views)

Re: alert mail send

You could do something like the following and add to crontab:

tail -1 /home/raj/lic.txt | grep -q "unable to connect"

if [ $? -eq 0 ]; then

   echo "Got unable to connect from $(hostname)" | mailx -s "Unable to connect" send-location@foo.com

fi

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation