Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm still not sure what you are asking. Are you asking how to write a crontab entry? If so, there is plenty of documentation. For example to send an email every 10 minutes:
No dude, i know how to make an entry in crontab. my question is:--
we can send mail to perticular mail id through crontab using MAILTO variable , if jobs are completed. but i wanna forward that mail to mail relay server. i know the ip of mail relay. plz tell me how to configure it? because there is no documentation on this.
Cron/Crontab was created to execute scheduled jobs, when it comes to mailing information, crontab relies on the presence of a mail facility. Mail forwarding is done by a mailing service and not crontab (cron/crontab is dumb in that regard).
Could you describe what your actual problem is? It looks like you've already chosen a certain path to look for a solution (change something in cron/crontab, which seems to be the wrong path).
Cron/Crontab was created to execute scheduled jobs, when it comes to mailing information, crontab relies on the presence of a mail facility. Mail forwarding is done by a mailing service and not crontab (cron/crontab is dumb in that regard).
Could you describe what your actual problem is? It looks like you've already chosen a certain path to look for a solution (change something in cron/crontab, which seems to be the wrong path).
Basically i created a centos mirror and i created a BASH script to update those packages on regular basis and scheduled it at 5am. i want to send a mail when it completes the job.
we have configured mail relay on another host. and i want whatever mail is sent when packages are updated that should be forwarded to that mail relay(192.168.0.X). and from there it will automatically be transferred to user mail box.
Basically i created a centos mirror and i created a BASH script to update those packages on regular basis and scheduled it at 5am. i want to send a mail when it completes the job.
That's the script part that runs from crontab. No problems there.
Quote:
we have configured mail relay on another host. and i want whatever mail is sent when packages are updated that should be forwarded to that mail relay(192.168.0.X). and from there it will automatically be transferred to user mail box.
The mail service you use on the mirror should be configured to do this and not cron.
Cron just sends mail to (for example) some.user@some.location.com and after it gives this mail to the mailer its job is done. The mail service decides what needs to be done with this specific mail.
The mail service you use on the mirror should be configured to do this and not cron.
Cron just sends mail to (for example) some.user@some.location.com and after it gives this mail to the mailer its job is done. The mail service decides what needs to be done with this specific mail.
It's little bit clear to me now. Does it mean that on my localhost, where i have created a mirror for centos, mail service (sendmail) should be configured? if so then plz tell me if i will configure forwarding in sendmail to a mail relay then user should get mail.
If that is the case, in that case what should be the "MAILTO" in crontab?
Does it mean that on my localhost, where i have created a mirror for centos, mail service (sendmail) should be configured?
If your mail needs to go to another location (not the local machine): Yes, you need to install and configure an MTA (sendmail is one of those, Postfix is another one).
Quote:
if so then plz tell me if i will configure forwarding in sendmail to a mail relay then user should get mail.
I'm not sure what it is your are asking/telling.
Quote:
In that case what should be the "MAILTO" in crontab?
MAILTO should contain the email address that mail should be send to. If the recipient is not on the local machine then a valid e-mail address must be used: user1@some.address.net (and _not_ just user1)
MAILTO should contain the email address that mail should be send to. If the recipient is not on the local machine then a valid e-mail address must be used: user1@some.address.net (and _not_ just user1)
does it mean that if i will give valid email id in MAILTO variable then cron will try to send mail to this email id via send mail which is configured in the same system and forwarding is enabled to relay.
does it mean that if i will give valid email id in MAILTO variable then cron will try to send mail to this email id via send mail which is configured in the same system and forwarding is enabled to relay.
in this situation, how should i configure sendmail?
could anyone tell me the configuration of sendmail?
There is no out-of-the-box configuration.
- You need to configure your local MTA to use a Smart relay host,
- You need to configure the MTA on your relay host to accept connections from your local MTA.
How this needs to be done depends on which MTA('s) you are using.
If(!!) your local host uses sendmail then editing the DS entry (under # "Smart" relay host (may be null)) should suffice (you do need to restart the service). Only you know the real FQDN (or IP) needs to be used, this is just a dummy example (mail is send to a host called other.mail.host): DSother.mail.host
Setting up the other side (the MTA on other.mail.host) is more complicated. You first of all need to figure out which MTA is used (sendmail, postfix, exim, .. , ..). After that you can configure it to accept mail from the outside.
Last edited by druuna; 11-13-2013 at 06:11 AM.
Reason: portfix -> postfix
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.