Operating System - HP-UX
1753518 Members
5075 Online
108795 Solutions
New Discussion

mailing the last 50 lines of syslog file

 
SOLVED
Go to solution
NDO
Super Advisor

mailing the last 50 lines of syslog file

Hi!

 

I have in my crontab a script that which is:

#!/bin/sh
egrep -i 'unhealthy|lost|failed|timed|error|warn' /var/adm/syslog/syslog.log | mailx -s "syslog issues" xxx@xxx.com

 

But it is sending all lines with those words.

How can I send just the last 50 lines of the syslog?

 

FR

2 REPLIES 2
Artur-M
Occasional Advisor
Solution

Re: mailing the last 50 lines of syslog file

egrep .... | tail -n 50 | mailx ...

?

NDO
Super Advisor

Re: mailing the last 50 lines of syslog file

Thanks a lot

 

fr