Quote:
Originally Posted by emgee3
I'd like a script that will e-mail me when it detects a certain line in a log file. I know I could do this by installing a log watching program and set it to run every 5 minutes. However, I don't want to install software on the server, I'd prefer a simple script to do this.
Something like:
Code:
tail -f /var/log/apache2/access_log | grep "GET /file.html HTTP/1.1" | mail -s "alert" my@email.com
but obviously something that works, as opposed to the above
|
cat .muttrc
set sendmail="/usr/bin/msmtp"
unset use_from
#set query_command="abook --mutt-query '%s'"
#macro pager A |'abook --add-email'\n
set query_command = "abook --mutt-query '%s'"
macro generic,index,pager \ca "<shell-escape>abook<return>" "launch abook"
macro index,pager A "<pipe-message>abook --add-email<return>" "add the
sender address to abook"
unset reply_self # if unset, a reply to yourself implies reply to
other
my_hdr Reply-To:
me@gmail.com
cat .msmtprc
account default
host smtp.gmail.com
port 587
from
me@gmail.com
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
auth on
user
me@gmail.com
password secretsecret
logfile ~/.msmtp.log
installation:
> apt-get -f -y --allow-unauthenticated install
> apt-get -f -y --allow-unauthenticated install mutt
> apt-get -f -y --allow-unauthenticated install libssl
> apt-get -f -y --allow-unauthenticated install openssl libssl0.9.7
> apt-get -f -y --allow-unauthenticated install sendmail-bin
>
> apt-get -f -y --allow-unauthenticated install msmtp
>
and crontab -e
15 7 * * * cd ; echo "hello" | mutt
me@gmail.com