LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-11-2009, 04:23 AM   #1
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013

Rep: Reputation: 30
email only received from logwatch


I am receving emails from logwatch but when I setup my own mail script using mutt, the script succeeds but no email is received.
Any ideas what the difference is between the two mail methods?
 
Old 08-11-2009, 04:24 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Perhaps you can tell us how you set it up ?
Look in the logfiles for errors

Last edited by repo; 08-11-2009 at 06:03 AM.
 
Old 08-11-2009, 05:07 AM   #3
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by repo View Post
Perhaps you can tell us how you set it up ?
Look in the logfiles or errors
just like this:
http://www.syntaxtechnology.com/?p=83

I ran the test commands and no errors were given so I'm thinking an email service or something? But then why would logwatch send successfully?
 
Old 08-11-2009, 05:46 AM   #4
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by qwertyjjj View Post
I am receving emails from logwatch but when I setup my own mail script using mutt, the script succeeds but no email is received.
Any ideas what the difference is between the two mail methods?
1st step:
check /var/log/maillog to see if any mail was ever sent out. logwatch sends email to root user.
are you doing the same?
 
Old 08-11-2009, 05:50 AM   #5
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by centosboy View Post
1st step:
check /var/log/maillog to see if any mail was ever sent out. logwatch sends email to root user.
are you doing the same?
I did that but there are only 10 lines in there using tail -f.
Anyway to view the whole logfile?
I changed the MailTo command in the logwatch.conf to an actual email address.
 
Old 08-11-2009, 06:04 AM   #6
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Code:
cat /var/log/maillog | more
or
open a terminal and type
Code:
tail -f /var/log/maillog
open a second terminal and execute the script
 
Old 08-11-2009, 07:13 AM   #7
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by qwertyjjj View Post
I did that but there are only 10 lines in there using tail -f.
Anyway to view the whole logfile?
I changed the MailTo command in the logwatch.conf to an actual email address.
change mailto in crontab too. by default it sends to the root user

Code:
/var/spool/mail/root
change this in your crontab

Code:
MAILTO=emailaddress
 
Old 08-11-2009, 11:24 AM   #8
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by repo View Post
Code:
cat /var/log/maillog | more
or
open a terminal and type
Code:
tail -f /var/log/maillog
open a second terminal and execute the script
Script and test as per: http://www.syntaxtechnology.com/?p=83
Have changed MAILTO in /etc/crontab as well but that's separate from this SystemEmail script.
Comes up with this in the log.
Aug 11 16:23:51 localhost postfix/postdrop[11861]: warning: unable to look up public/pickup: No such file or directory
Aug 11 16:24:15 localhost postfix/postdrop[11895]: warning: unable to look up public/pickup: No such file or directory

Last edited by qwertyjjj; 08-11-2009 at 11:27 AM.
 
Old 08-11-2009, 11:10 PM   #9
AWegner
LQ Newbie
 
Registered: Aug 2009
Distribution: Fedora/CentOS/RedHat
Posts: 2

Rep: Reputation: 0
Forgive the elementary questions:

1.) The script uses mutt to send emails
Code:
echo "${SHUTDOWNBODY}" | mutt -s "${SHUTDOWNSUBJECT}" ${EMAIL}
. Do you have mutt installed?
2.) There is a variable at the top of the script. Did you change it from example@example.com to your address?
Code:
EMAIL="example@example.com"
3.) What distro are you attempting this from? I assume CentOS from the information under your username, but I just wanted to make sure.
4.) When running either
Code:
./SystemEmail start
or
./SystemEmail stop
what is the output of
Code:
echo $?
If the return code is zero, does root receive a returned email with failure reason?

5.) If you run (using your email address)
Code:
echo "TEST BODY" | mutt -s "TEST SUBJECT" example@example.com
does it work?

Last edited by AWegner; 08-11-2009 at 11:24 PM.
 
Old 08-12-2009, 03:13 AM   #10
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013

Original Poster
Rep: Reputation: 30
mylog.log contains nothing this morning.
Is it possible the crontab didn't write to it using this code?
The sarg reports ran correctly...just nothing after that...
Code:
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
00 23 * * * root /usr/bin/sarg
00 00 * * * root /etc/cron.daily/0logwatch 2 >> /root/mylog.log
00 01 * * * root /bin/tar -cvvf /root/backup-`/bin/date +%d%m%Y`.tar /etc /var/log /var/www /usr/lib/squid/ncsa_auth 2 >> /root/mylog.log
10 01 * * * root /bin/gzip /root/backup-'/bin/date +%d%m%Y'.tar 2 >> /root/mylog.log

Quote:
Originally Posted by AWegner View Post
Forgive the elementary questions:

1.) The script uses mutt to send emails
Code:
echo "${SHUTDOWNBODY}" | mutt -s "${SHUTDOWNSUBJECT}" ${EMAIL}
. Do you have mutt installed?
Yes, in /usr/bin/mutt.
Quote:
2.) There is a variable at the top of the script. Did you change it from example@example.com to your address?
Code:
EMAIL="example@example.com"
Yes.
Quote:
3.) What distro are you attempting this from? I assume CentOS from the information under your username, but I just wanted to make sure.
Yes, centOS.
Quote:
4.) When running either
Code:
./SystemEmail start
or
./SystemEmail stop
what is the output of
Code:
echo $?
When I run those commands from the prompt, there is no output at all. It just returns with a new prompt line.
Quote:

If the return code is zero, does root receive a returned email with failure reason?

5.) If you run (using your email address)
Code:
echo "TEST BODY" | mutt -s "TEST SUBJECT" example@example.com
does it work?
I ran this and just received a new prompt but no email as yet.

---------------------
When I run this directly from the command line, it goes into some kind of editor?????
mutt -s "TEST" email@myactualemailaddress.com

Also, the logs said something about:
postdrop: warning: unable to look up public/pickup: No such file or directory

Last edited by qwertyjjj; 08-12-2009 at 03:57 AM.
 
Old 08-12-2009, 06:31 AM   #11
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Quote:

echo "TEST BODY" | mutt -s "TEST SUBJECT" example@example.com

does it work?
I ran this and just received a new prompt but no email as yet.
While doing this, in another terminal type
Code:
tail -f /var/log/mail.log
what is the output from the command logged in as root ?
Code:
mail
Mail sent to root arrives in root's inbox.
You can change this by editing
/etc/aliasses
root:username

Last edited by repo; 08-12-2009 at 06:36 AM.
 
Old 08-12-2009, 06:45 AM   #12
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by repo View Post
While doing this, in another terminal type
Code:
tail -f /var/log/mail.log
what is the output from the command logged in as root ?
Code:
mail
Mail sent to root arrives in root's inbox.
You can change this by editing
/etc/aliasses
root:username
Same error as before:
Aug 12 11:44:22 localhost postfix/postdrop[2894]: warning: unable to look up public/pickup: No such file or directory
 
Old 08-12-2009, 07:01 AM   #13
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Take a look at
http://ubuntuforums.org/showpost.php...98&postcount=6
 
Old 08-12-2009, 07:07 AM   #14
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by repo View Post
But logwatch uses sendmail doesn't it?
Like I said, the command works, just not when run from crontab?! Strange
Same error as before:
Aug 12 11:44:22 localhost postfix/postdrop[2894]: warning: unable to look up public/pickup: No such file or directory

Last edited by qwertyjjj; 08-12-2009 at 07:09 AM.
 
Old 08-12-2009, 07:10 AM   #15
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
It uses the MTA installed.
Are they th installed?
sendmail and postfix ?

Quote:
Aug 12 11:44:22 localhost postfix/postdrop[2894]: warning: unable to look up public/pickup: No such file or directory
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pipe'ing the ouput of 'cat' into 'mutt' (email) losses newlines when email received helptonewbie Linux - Newbie 2 08-28-2008 03:16 AM
logwatch email notification sachin1361 Linux - Enterprise 5 05-29-2008 07:52 AM
Archiving both received and sent email? neocookie Linux - Server 3 09-26-2007 09:13 AM
logwatch - duplicate email aolong Linux - Server 3 09-11-2007 12:41 PM
Logwatch can't email me soren625 Linux - General 15 12-16-2004 11:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration