Operating System - Tru64 Unix
1753479 Members
5306 Online
108794 Solutions
New Discussion юеВ

Unable to email from a cron entry

 
IE Admins
Advisor

Unable to email from a cron entry

I've got a script running in the root crontab of one of my Tru64 boxes (v5.1) which sends an email out with some system information on a regular basis.
The same script runs on some other HP-UX systems and works fine.
The recipient of the email has never received an email from my Tru64 system...

In the process of investigating the problem I found that you cannot email from the crontab (I only tried root crontab) as per the following:

* * * * * /usr/bin/mailx -s "Testing from hostname" email@domain.com < /tmp/message > /tmp/err.log 2>&1

No error messages are output to the err.log.

The command works fine from the command prompt...

Is anyone aware of why this doesn't work or if it is a known problem with a workaround/solution?

Thanks in advance.
11 REPLIES 11
Ralf Puchner
Honored Contributor

Re: Unable to email from a cron entry

maybe it is a permission or environment variable problem.
Help() { FirstReadManual(urgently); Go_to_it;; }
Michael Schulte zur Sur
Honored Contributor

Re: Unable to email from a cron entry

Hi,

have you checked mail?
Maybe it cannot execute the mailx command due to reasons other than the script.
Otherwise it should work, I have used your command on a host of us and it worked.
Also check /var/adm/syslog.dated/current/mail.log

Michael
IE Admins
Advisor

Re: Unable to email from a cron entry

I was thinking that also but I can't see any permission problems... and if it was a permission problem executing mailx then I'd get a message along those lines in err.log

Anyway I've moved the script to the adm users crontab and it now works fine, so it's as good as fixed.

Weird...
IE Admins
Advisor

Re: Unable to email from a cron entry

I was thinking that also but I can't see any permission problems... and if it was a permission problem executing mailx then I'd get a message along those lines in err.log

/var/adm/syslog.dated/current/mail.log appears to indicate that the emails are being accepted for delivery but they simply dissapear somewhere along the line. They do not show up in our mail server's mailqueue either.

Anyway I've moved the script to the adm users crontab and it now works fine, so it's as good as fixed.

Weird...
Ralf Puchner
Honored Contributor

Re: Unable to email from a cron entry

In your problem description you gave us the "mailx" line within the crontab, now you are talking about "moving the script".

btw. checking permissions was my idea
Help() { FirstReadManual(urgently); Go_to_it;; }
Michael Schulte zur Sur
Honored Contributor

Re: Unable to email from a cron entry

Hi Bill,

this doesn??t make much sense to me, why it should work with adm and not root!.
Is the crontrab user really the only thing, you changed?

Hi Ralf,

I think, everyone should get points as a reward for the help they provide for other users. I think however, that a HP employee has a somewhat unfair advantage. He is sitting at the source, where all troubles are reported, all documentation is accessible, more than to the public.

Since this is not the first time, you are complaining about not receiving proper recognition, one might get the idea, life and death depends on it. Cool down. ;-) You already have more points than the rest combined in the tru unix forum! After all, it should be a place to share and have fun! Don??t you think too?

best regards,

Michael
Ralf Puchner
Honored Contributor

Re: Unable to email from a cron entry

Hi Michael,

I also spent much time outside of the working hours to moderate this forum and to find answers for the forum members.

It is not my goal that I must answer any question here. There are also other HP members in this forum, yes I have a lot of points but I've worked hard to get it and a lot of answers with a final solution were not voted. That is ok, but it is really unfair to repeat the answer of other persons and not voting for the original answer.

regards

Ralf

Help() { FirstReadManual(urgently); Go_to_it;; }
Michael Schulte zur Sur
Honored Contributor

Re: Unable to email from a cron entry

Hi Ralf,

I see your point. User, who get valuable advice should at least acknowledge this by giving the credits to whom they are due. I wonder, whether people don??t pay much attention, to what other people write, otherwise they would not have just repeated, what is already said. In this case I am not sure, for which part I got the 3 points, but since you already mentioned permission issues, I avoided mentioning them again.

Do I understand you correctly, that participating here is a part of your work, you normally would prefer not to do? I do hope not. But thank you for sharing your thoughts about this matter and for your efforts to contibute to this worthy cause.

best regards,

Michael Schulte
Ralf Puchner
Honored Contributor

Re: Unable to email from a cron entry

Hi Michael,

moderating the Tru64 forum is part of my work but it is not part of my work answering any technical question.

There are also other HP forum moderators and support staff around spending time to answer questions here in the forum.

regards

Ralf






Help() { FirstReadManual(urgently); Go_to_it;; }