Operating System - HP-UX
1753863 Members
7316 Online
108809 Solutions
New Discussion

script log to email body.

 
SOLVED
Go to solution
rmueller58
Valued Contributor

script log to email body.

I have a process that will mail out a log via a command:  "mail  -s "Log" myemailaddress@domain.tld </tmp/move.sh.log"

 

It is odd behavior, some work and others do not,

 

the "log" is parsed into the body of the email. 

I set up a new script and now the log is attached as an ATT00001..bin file, and when opened it appears theres is no CR/LF as the log file is now one contiguous line.
Need to find a way to correct it.

It is baffling. any ideas from the script gurus would be appreciated.. rm

4 REPLIES 4
Bill Hassell
Honored Contributor

Re: script log to email body.

ASCII files are different between Windows and Unix systems. Unix systems use just a linefeed at the end of each line but Windows (and their relatives like Outlook, etc) requires carriage return and linefeed together in order to look 'norma'l. Actually, normal is very non-standard. Wordpad and Word can read Unix style files with no problem as the single LF is taken as a soft line break. However, Notepad and other Window utilities will treat the bare LF character (without LF) as no-action character Notepad shows the LF as a black square.

 

Here is a blog that will help:

     http://blog.sourcedirect.com/?s=email+attachment

 

 



Bill Hassell, sysadmin
Dennis Handly
Acclaimed Contributor
Solution

Re: script log to email body.

In addition to what Bill says, some versions of Outlook also have an option to the LF as a line break and that will help you read the message.

 

Or you could use ux2dos:

ux2dos /tmp/move.sh.log | mailx -s "Log" myemailaddress@domain.tld 

 

>now the log is attached as an ATT00001..bin file

 

I'm not sure why it is attached, nobody complains about that for my messages. ??

rmueller58
Valued Contributor

Re: script log to email body.

Thanks Bill,

 

I should have prefaced the email a bit, the fact is I was migrating from fedora 7 to a VM of Fedora 14. the behavior was the same script from my FC7 box. I've back burner the project as we are migrating to a full blown microsoft environment.. Have a learning curve in front of me. :-o

rmueller58
Valued Contributor

Re: script log to email body.

thanks Dennis for the reply.  I took my scripts back to original FC 7 box. no problems now. Kind of pointless to migrate if we will be migrated scripting to Microsoft SSIS in 6 months or a year..