Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

mailing the last 50 lines of syslog file

 
SOLVED
Go to solution
Highlighted
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
Highlighted
Artur-M
Occasional Advisor
Solution

Re: mailing the last 50 lines of syslog file

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

?

Highlighted
NDO
Super Advisor

Re: mailing the last 50 lines of syslog file

Thanks a lot

 

fr