Serviceguard
cancel
Showing results for 
Search instead for 
Did you mean: 

How to add mail functionality when pkg switches over?

Karthik Dathathri_1
Occasional Contributor

How to add mail functionality when pkg switches over?

I'm a newbie to ServiceGuard but has some basic working knowledge of SG packages/control scripts.

Actually, I want to add functionality of sending e-mail to SysAdmin when a package switches over from one node to another.

Any pointers for the same would be helpful? Do I need to add it in .mon script or pkgctl script?

Thanks & Regards,
Karthik
1 REPLY
renarios
Trusted Contributor

Re: How to add mail functionality when pkg switches over?

Hi Karthik,

I should add the mailx command in the package control scripts. There's a section for custom commands. Write a nice script and put it in the ctl script.

Maybe the next syntaxes help you a bit on the way:

Mail No attachment, body only -

mailx -m -s "Some Subject" somone@somewhere.com < file_for_email_body

Mail with attachement, no body -

ux2dos /path_to/some_file | uuencode some_file.txt | mailx -m -s "MAIL FROM Someone" someone@somewhere.com

Mail with attachment and body -

ux2dos /path_to/some_file | uuencode some_file.txt | mailx -m -s "MAIL FROM Someone" someone@somewhere.com < file_for_email_body

Mail with carbon and blind carbon -

mailx -m -s "Some Subject" somone@somewhere.com < file_for_email_body

(the file_for_email_body should look like this - )
~c someone_to_cc@somewhere.com
~b someone_to_bc@somewhere.com
The remainder of this file is the text body of the email.

Mail as another sender

echo "Hello" | mailx -m -s "Greeting" -r Santa.Claus@north_pole.com someone@somewhere.com

Mail with multiple attachments (The sentence "This is all you get." will appear as the body.)

mailx -m -s "Hello" someone@somewhere.com << END
`ux2dos /home/some_file | uuencode some_file.txt`
`ux2dos /home/some_other_file | uuencode some_other_file.txt`


Cheerio,

Renarios
Nothing is more successfull as failure