[Wolves] Help writing a script file

Simon Morris simon.morris at cmtww.com
Thu May 18 15:24:37 BST 2006


On Thu, 2006-05-18 at 15:04 +0100, Peter Cannon wrote:
> Hi All
> 
> Anyone interested in writing a script file? Or giving me an idiots
> tutorial?
> 
> I'd like it to grab the last 10 entries from two logs, combine them
> into one
> file/email, then email it to me probably via internet rather than
> local
> delivery.
> 
> the locations are
> 
> /var/lib/simias/log/adminweb.log
> /var/lib/simias/log/web.log
> 
> If possible I'd like the format to be something like
> 
> adminweb 18.5.2006 14:52
> =====================================
> Blah blah blah
> Blah blah blah
> Blah blah blah
> 
> web 18.5.2006 14:53
> =====================================
> Blah blah blah
> Blah blah blah
> Blah blah blah
> 
> I can then setup a cron job. Obviously I'll give the writer full
> credit.


How about

-----START SCRIPT-----

#!/bin/bash

MAILTO=simon.morris at cmtww.com
MAILTO2=pete at somedomain.com

mail -s "This is the subject line" "${EMAILTO}" -c "${EMAILTO2}" << EOF

adminweb 18.5.2006 14:52
=====================================

`tail -n 10 /var/lib/simias/log/adminweb.log`

web 18.5.2006 14:53
=====================================

`tail -n 10 /var/lib/simias/log/web.log`

EOF

-----END SCRIPT-----

~sm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mailman.lug.org.uk/pipermail/wolves/attachments/20060518/22916e09/attachment.bin


More information about the Wolves mailing list