- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- ux2dos file from unix to dos
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-05-2012 10:30 PM - edited тАО03-05-2012 10:55 PM
тАО03-05-2012 10:30 PM - edited тАО03-05-2012 10:55 PM
I am trying to send last line of log file (say syslog.log) in mail as ,
sendmail -f monitoring@server21.com -t rtango@server21.com<<EOF
Subject:ALERT:SERVER - AnyNAme : OS USER - AnyUSER EXPIRES IN anydays left DAYS
`tail -20 /var/adm/syslog/syslog.log >> /tmp/test123.txt;cat /tmp/test123.txt`
EOF
1)when i open it in unix it like this :
Mar 6 07:00:00 server21 ntpdate[8270]: step time server 128.1.150.105 offset 0.003329 sec
Mar 6 07:15:00 server21 ntpdate[12817]: step time server 128.1.150.105 offset 0.003556 sec
Mar 6 07:30:00 server21 ntpdate[17337]: step time server 128.1.150.105 offset 0.000702 sec
Mar 6 07:45:00 server21 ntpdate[21903]: step time server 128.1.150.105 offset 0.004069 sec
Mar 6 08:00:00 server21 ntpdate[26494]: step time server 128.1.150.105 offset 0.003840 sec
Mar 6 08:15:00 server21 ntpdate[1162]: step time server 128.1.150.105 offset -0.002275 sec
Mar 6 08:26:35 server21 sshd[4710]: SSH: Server;Ltype: Version;Remote: 128.1.150.114-1114;Protocol: 2.0;Client: PuTTY-Release-0.54
Mar 6 08:26:42 server21 sshd[4710]: error: PAM: Authentication failed for tango1 from 128.1.150.114
Mar 6 08:26:45 server21 sshd[4710]: Accepted password for tango1 from 128.1.150.114 port 1114 ssh2
Mar 6 08:27:01 server21 su: + 0 tango1-root
2)In mail (outlook) the file seems as :
Mar 6 07:00:00 server21 ntpdate[8270]: step time server 128.1.150.105 offset 0.003329 sec Mar 6 07:15:00 server21 ntpdate[12817]: step time server 128.1.150.105 offset 0.003556 sec Mar 6 07:30:00 server21 ntpdate[17337]: step time server 128.1.150.105 offset 0.000702 sec Mar 6 07:45:00 server21 ntpdate[21903]: step time server 128.1.150.105 offset 0.004069 sec Mar 6 08:00:00 server21 ntpdate[26494]: step time server 128.1.150.105 offset 0.003840 sec Mar 6 08:15:00 server21 ntpdate[1162]: step time server 128.1.150.105 offset -0.002275 sec Mar 6 08:26:35 server21 sshd[4710]: SSH: Server;Ltype: Version;Remote: 128.1.150.114-1114;Protocol: 2.0;Client: PuTTY-Release-0.54 Mar 6 08:26:42 server21 sshd[4710]: error: PAM: Authentication failed for
i tried ux2dos , but still it's same.
i also tried the solutin in this thread mentioned by JRF and Laurent , but seems likei am missing something,
Solved! Go to Solution.
- Tags:
- ux2dos
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-06-2012 01:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-06-2012 03:54 PM - edited тАО03-06-2012 03:57 PM
тАО03-06-2012 03:54 PM - edited тАО03-06-2012 03:57 PM
Re: ux2dos file from unix to dos
You are passing the text the hard way -- and the shell doesn't know that you want to treat the stream of data as text. mailx is much more suitable for scripting:
tail -20 /var/adm/syslog/syslog.log | mailx -s "Whatever subject you want" -r rtango@server21.com monitoring@server21.com
This method eliminates the temp file (which wasn't needed in the original code either) and is much easier to understand.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-06-2012 04:59 PM - edited тАО03-06-2012 05:07 PM
тАО03-06-2012 04:59 PM - edited тАО03-06-2012 05:07 PM
Re: ux2dos file from unix to dos
>mailx is much more suitable for scripting
Yes, using mailx is better than sendmail.
>which wasn't needed in the original code either
You can't really tell since it was appending to that file. :-)
Also, I think you have reversed the sendmail -f and -t. The former takes a from alias parm, the latter says look at the body (and doesn't take a parm).
tail -20 /var/adm/syslog/syslog.log >> /tmp/test123.txt
mailx -s "Whatever subject you want" -r monitoring@server21.com rtango@server21.com < /tmp/test123.txt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2012 11:20 PM
тАО04-06-2012 11:20 PM
Re: ux2dos file from unix to dos
Try Basic text option, with no text formatting allowed. If it helps well and good.