LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-16-2011, 11:37 AM   #1
ciuly
LQ Newbie
 
Registered: Jun 2009
Location: Romania
Distribution: CentOS CLI-only kernel 2.6.18-194.32.1.el5
Posts: 24

Rep: Reputation: 2
Sendmail.xmail From Cron, seems to "freeze" or something


I'm running xmail 1.26 on centos. Everything is working fine except getting email from cron for jobs that output stuff (I am getting the daily logwatch which contains the jobs ran and "MAIL sending errors X Time(s)", where X varies (today, that X is going to be very high))

the xmail sendmail replacement is setup according to docs (AFAIK) and looks like this:
Code:
[root@Impuls pinger]# ll /usr/lib/sendmail
lrwxrwxrwx 1 root root 30 Jan 21  2010 /usr/lib/sendmail -> /etc/alternatives/mta-sendmail
[root@Impuls pinger]# ll /etc/alternatives/mta-sendmail
lrwxrwxrwx 1 root root 26 Jun  9  2010 /etc/alternatives/mta-sendmail -> /usr/lib/sendmail.sendmail
[root@Impuls pinger]# ll /usr/lib/sendmail.sendmail
lrwxrwxrwx 1 root root 16 Jun  9  2010 /usr/lib/sendmail.sendmail -> ../sbin/sendmail
[root@Impuls pinger]# ll /usr/sbin/sendmail
lrwxrwxrwx 1 root root 27 Jan 30  2010 /usr/sbin/sendmail -> /usr/sbin/sendmail.xmail.sh
[root@Impuls pinger]# ll /usr/sbin/sendmail.xmail.sh
-rwxr-xr-x 1 root root 132 Jan 19  2006 /usr/sbin/sendmail.xmail.sh
[root@Impuls pinger]# ll /usr/sbin/sendmail.xmail
-rwsr-sr-x 1 root root 18484 Jan 30  2010 /usr/sbin/sendmail.xmail  (note the +s is in place as needed)
[root@Impuls pinger]# ll /var/MailRoot/bin/sendmail
-rwxr-xr-x 1 root root 14324 Jan 30  2010 /var/MailRoot/bin/sendmail
the sendmail.xmail script looks like this:
Code:
[root@Impuls pinger]# cat /usr/sbin/sendmail.xmail.sh
#!/bin/sh
export DEFAULT_DOMAIN="ciuly.com"
if [ -z $MAIL_ROOT ]; then
export MAIL_ROOT=/var/MailRoot
fi
/usr/sbin/sendmail.xmail $*
[root@Impuls pinger]#
now, when the cron runs the job (it's just a script that verifies if the actual job is running and if not it starts it, outputting that it did so), things will look like this (pstree output):
Code:
[root@Impuls pinger]# ps -Af | grep ping
root     15141 15140  0 00:11 ?        00:00:00 [gpinger.chk] <defunct>
root     15150     1  0 00:11 ?        00:00:00 /usr/bin/php /www/pinger/pinger.php 1
root     15163 15162  0 00:12 ?        00:00:00 [ipinger.chk] <defunct>
root     15172     1  0 00:12 ?        00:00:00 /usr/bin/php /www/pinger/pinger.php 2
more
Code:
root     30465  2558  0 04:21 ?        00:00:00 crond
root     30466 30465  0 04:21 ?        00:00:00 [gpinger.chk] <defunct>
root     30473 30465  0 04:21 ?        00:00:00 /bin/sh /usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t
cron log on system says something like this:
Code:
Jun 16 08:00:11 Impuls crond[1001]: (root) MAIL (mailed 514 bytes of output but got status 0x0007 )
the sent bytes varies depending on which script generates the error.
I couldn't find what the 0x0007 error code means.

any ideas why the sendmail from cron is freezed/failed?

thanks.
 
Old 06-16-2011, 04:27 PM   #2
ciuly
LQ Newbie
 
Registered: Jun 2009
Location: Romania
Distribution: CentOS CLI-only kernel 2.6.18-194.32.1.el5
Posts: 24

Original Poster
Rep: Reputation: 2
Managed to finally track it down, after reading this message here: http://permalink.gmane.org/gmane.mai...l.general/5046
basically I experimented with tweaking the command line parameters and by mistake, at a given point I wrote the newargs expression wrong (I had some debug stuff in place), resulting in a singular word, which raised an error in the mailer daemon of a non-existing account.
so in the end I ended up with the following sendmail.xmail.sh
Code:
#!/bin/sh
export DEFAULT_DOMAIN=mydomain.tld
if [ -z $MAIL_ROOT ]; then
  export MAIL_ROOT=/var/MailRoot
fi

iscron=`echo $* | grep FCronDaemon`
if [ -n "$iscron" ]
then
  /usr/sbin/sendmail.xmail root
else
  /usr/sbin/sendmail.xmail $*
fi
 
  


Reply



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
OpenSSL / Sendmail verifies both "TLS cert" and "x509 cert" in client mode, why? fast-reflexes Linux - Server 0 09-12-2010 11:32 AM
2 specific Sendmail questions about "delay_checks" and "Connect:" in access.db fast-reflexes Linux - Server 0 08-05-2010 09:33 AM
script using "/usr/bin/cat error" produces "cannot open" in cron Dcrusoe Programming 6 07-22-2009 03:30 PM
"numlock" and "capslock" freeze keyboard evilchild SUSE / openSUSE 2 07-04-2005 10:39 AM
Monthly Archiving Script... help with "date" & "cron" Supp0rtLinux Linux - Software 3 01-03-2003 09:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:20 PM.

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