Forum Moderators: bakedjake

Message Too Old, No Replies

cron jobs and email

         

Nutter

9:17 pm on Feb 26, 2005 (gmt 0)

10+ Year Member



I've got several cron jobs on a VPS server that email results to me. But, there are a few that don't. Where is that setting?

Also, I'm trying to set up the same process on a local file server. What steps are involved? I've installed sendmail under the assumption that it is required. But, I don't know how to configure it.

Thanks,
- Ryan

MattyMoose

10:55 pm on Feb 28, 2005 (gmt 0)

10+ Year Member



There is no setting, for the most part. If your script has no output, then you don't get emailed, since there's no output. Otherwise, it will email you whatever was output to stdout.

StupidScript

12:33 am on Mar 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Or it will send any output to root's mail account, or whomever you are running the cronjob as.

Nutter

8:20 pm on Mar 9, 2005 (gmt 0)

10+ Year Member



Ok, possibly stupid question:

I've got cron jobs running on a file server. What do I need to set up to have them email to my account? The file server is sitting right next to my computer if that matters, and I've never sent emails from it. If you'll just point me to the right commands / settings / web pages, I'll figure it out. I just have no idea even where to look.

Thanks,
- Ryan

StupidScript

8:27 pm on Mar 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



From the file server with sendmail installed: can you send mail?

From the "src" directory:

./sendmail -bt -C ../cf/cf/sendmail.cf

or wherever your sendmail.cf file is located.

Sendmail will return a

>
prompt. Check for various mailing capabilities by entering:

1) USER (should report local delivery)
2) USER@HOST (should report local delivery)
3) USER@HOST.DOMAIN (should report local delivery)
4) USER@HOST2 (should report SMTP delivery)
5) USER@HOST2.DOMAIN (should report SMTP delivery)

Use every valid HOST for the first 3 tests (i.e. myuser@mydomain , myuser@mailhost , etc.) The specified USER does not need to exist. Perhaps you should use "test" as the USER. Any hosts and domains that are NOT local do not need to exist. This testing is not actually going to send the mail, it just checks to make sure sendmail is set up properly.

Then, test to see if sendmail will actually send the mail:

./sendmail -t -v -C ../cf/cf/sendmail.cf < test.msg

where

test.msg
is a text file containing complete From: To: and Subject: header lines, like:

To: USER@HOST

From: myuser@mydomain.com

Subject: Testing sendmail

The message should be received by the specified USER on the specified HOST. Try delivering mail to yourself on the local machine with a local user before testing it over the 'net.

[edited by: StupidScript at 8:39 pm (utc) on Mar. 9, 2005]

Nutter

8:29 pm on Mar 9, 2005 (gmt 0)

10+ Year Member



So, install mail server (which may already be done, haven't checked.) Exim, sendmail; those are the names I've heard. Then is there a setting to map all root email to me@mydomain.com?

I apologize, I'm pretty new at a bunch of this stuff.

StupidScript

8:40 pm on Mar 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In your sendmail's "aliases" file you can indicate that all root mail should go to the email address you want it to:

root: myuser@mydomain.com

Sendmail is installed on the file server, yes? If the file server is a Linux box, I suggest you install Webmin (any search will find it) for a more user-friendly admin interface ... at least until you get crazy about working in a console. :)