Jump to content

Recommended Posts

Posted

I've worked out a shell script which collects various information, parses it a bit with grep and a few other standard commands, and spits out a file called 'error.log' which, if it contains anything, needs to be e-mailed to an address of my choosing along with the unparsed file. Both files are plain text, and don't need to be actually attached to the message - they just need to be printed in the body.

 

I've played around with sendmail a bit, tried piping in my file with the 'proper' header, but can't quite get it to shoot the e-mail off.

 

Does anyone know a good way to do this, or even better have a small code snippet to show how to do this? I know it's fairly simple, I'm probably just missing something small.

 

Thanks for any help.

Posted

Oh, I also tried to create a file that contains:

 

===================

To: addr@****

From: addr2@****

Subject: My subject here

 

Here is test data

 

===================

 

And then running:

 

/usr/sbin/sendmail -t < testfile

 

It doesn't give any error, but I also don't receive the e-mail.

Posted

Solved. I just started to get the e-mails... it appears that it takes an hour or two to work it's way through sendmail for some reason. Seems to work halfway decent.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...