Cron Job not sending E-mails
Hello,
I have been trying to set up a cron job that sends me an e-mail with a subject line so I know the cron job did run. I was looking the information from the following: http://www.linuxquestions.org/questi...n-jobs-886164/ I did what the post said but I never got the e-mail and I checked the spam folder and nothing. Here is the way I set up the cron job in crontab -e: MAILTO=emailaddress@gmail.com?subject=Maldet Updated!! * 1 * * 0 /usr/local/sbin/maldet -u I set it up for different times to see if it was running and to keep an eye on my e-mail but I never get anything and I'm not sure if I am missing something which is why it is not running or where else to check to see if it ran or not because I never get the e-mail. Thanks for the help in advance! |
MAILTO can ONLY be an address.
Used by cron to report an error if a cronjob fails. The default is usually the job owner (or root). If you want to send an email, ignore that and use an example from here http://stackoverflow.com/questions/2...-mailx-command cron howto http://www.adminschoice.com/crontab-quick-reference You probably don't want to send an email every minute ... Note also that places like google, yahoo etc often won't accept emails from dynamic IPs because of the amt of SPAM that comes from such systems. If you want to pass an email out, you may have to go via your ISP's mailservers, to get around that problem. |
Hello,
Thank you for your reply! The information you have provided was very helpful in understanding how this works! So, from what I read you can use mailx to send out the e-mail as I wanted by using the following command: echo "something" | mailx -s "subject" recipient@somewhere.com Would this go before the cron job or next to it? For example: echo "something" | mailx -s "subject" recipient@somewhere.com * 1 * * 0 /usr/local/sbin/maldet -u OR * 1 * * 0 /usr/local/sbin/maldet -u | echo "something" | mailx -s "subject" recipient@somewhere.com OR * 1 * * 0 /usr/local/sbin/maldet -u > echo "something" | mailx -s "subject" recipient@somewhere.com I think if I can get this one part clear everything would work out perfectly with the information you have provided me! Thanks!!! :) |
Depends what maldet does, but you could try
Code:
* 1 * * 0 (/usr/local/sbin/maldet -u )| mailx -s "subject" recipient@somewhere.com |
Thanks!!!
Hey, did what you told me in your previous reply and it worked perfect! Thank you so much for your help!!!!
Quote:
|
Glad to help :)
|
All times are GMT -5. The time now is 07:22 PM. |