Sponsored Content
Top Forums Shell Programming and Scripting cron not sending external mails Post 302579558 by robo on Tuesday 6th of December 2011 04:05:29 AM
Old 12-06-2011
cron not sending external mails

This script is to send a email if the IP adress is active
when i run this script it is working and sending emails to external users in different domains, but when this script is scheduled in a cron it is unable to send the emails
Code:
 
#/bin/sh
ifconfig -a | grep 192.168.0.1
if [ $? == '0' ];
then mail -s "subject" mail.domain.com < /home/user/mailmessage.txt
fi

So i used a while loop avoding cron, Below is the code, This is able to send the emails,

Code:
#/bin/sh
while :
do
ifconfig -a | grep 3.229.224.157
if [ $? == '0' ]
then 
   mail -s "CRITICAL!! PAN Credit Application Load Balancing Has Failed Over to MYUKSLCAP2LB002" -c \
  emailaddress@fqdn.com < \
   /home/smg_prod/mailmessage.txt
fi
sleep 60
done

But for the same code why it is not able to send emails when set via cron, checked cronlogs and found no errors, cron is executed as schedules, also checked messages no errors found

Last edited by robo; 04-12-2012 at 10:46 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sending Mass mails

Hi Forum, I am extremely new to unix.Can somebody please help me out with the following: I am supposed to write a script that will ftp a file which is a .csv and conatins the following: Mail-id Path of file abc@xyz.com D:\xyz\abc.htm ash@sde.com ... (1 Reply)
Discussion started by: iyerdeepa82
1 Replies

2. UNIX for Advanced & Expert Users

sending mails with attachment and also some text in mail body

Hi, Can some one help me with the syntax of the mailx that should send an attachment and also some text in the message body together. When I am using the following syntax it is not sending the attachment but only the message body. unix2dos -ascii $REPORTFILE | uuencode $PCFILE | mailx -s... (7 Replies)
Discussion started by: guptan
7 Replies

3. IP Networking

Sending mails using plsql program

I am trying to send an email to personal id using plsql program. I have written a code in plsql using UTL_TCP package where opens the connections and then senda a mail. But when i execute the program mails are not being sent. I typed "mail" command on the unix box and got the below result... (5 Replies)
Discussion started by: amol_mudholkar
5 Replies

4. Shell Programming and Scripting

error while sending mails through MKS

#!/bin/ksh email0="dummy@company.com" emails() { # mail Generation echo "Hi" | /mapimail -s "-(Test Mail)From Production- `date`" $email0; } emails i receive the following error IDispatch::new MSMAPI.MAPISession failed: 800401f3 at... (0 Replies)
Discussion started by: Vrgurav
0 Replies

5. UNIX for Dummies Questions & Answers

Sending mails to various users without hard coding the email IDS

Hi Can any one help me out ? I am trying to send an autogenerated mail with an attachment to bulk of users using 'MAILX' and 'UNENCODE' . I have used it as follows X " ( cat /sastemp/body.txt; uuencode Test.xls.gz Test.xls.gz ) | mailx -s 'Testing' ' abcd@yahoo.com , efgh@gmail.com ' " ... (9 Replies)
Discussion started by: manas6
9 Replies

6. UNIX for Dummies Questions & Answers

Can't configure sendmail to send mails to external SMTP Server

Hi all,I know, that this is very common issue, but I can't find where is the problem... I have Solaris 10 installed.I want to send mail to external SMTP server, like:echo "letter body"| mailx -s "subject" test@test.comBut I donno what kind of changes I have to do in /etc/hosts and sendmail.cf or... (5 Replies)
Discussion started by: nypreH
5 Replies

7. Solaris

Unable to send mails to external mailids from solaris 10

Hi, Iam not able to send mails from solaris servers to external mailid (gmail,yahoo).I am able to send mails to internal mailids with in network. Requesting you all to please help me to resolve this issue. Thanks in advance. Venkat (2 Replies)
Discussion started by: venkatasiva85
2 Replies

8. Solaris

Crontab schedule sending two mails insted of one

Hi all, We have scheduled one cronjob which is supposed to show output through mails about 15 systems's current status (whether its up or down) but it send two mails one about 10 system which arrive at 5.30(actual scheduled time) and in second mail about 5 systems. We want all these... (1 Reply)
Discussion started by: manalisharmabe
1 Replies

9. Solaris

Sending Mails to the Multiple Email Address

Hi All, I am pretty new to the mail service in Sun Solaris 5.10. If anybody help me in writing a script for the multiple recipient with subject and the body would be a helpful. Kindly help... Thanks in advance. :) Warm Regards, Pramod (5 Replies)
Discussion started by: Pramod_009
5 Replies

10. Solaris

Solaris - Sendmail - Adding .com.gr in external senders e-mails

Hello Everybody ! I'm Harry from Athens Greece and i have a problem with my Sendmail 8.13.3 installed on Solaris SunOS ultra 5.10. The problem is that when someone sends to us an e-mail and his e-mail address is like : xxxx@xxxx.com, our e-mail server adds up in the senders address a .com.gr... (2 Replies)
Discussion started by: Mcasim
2 Replies
GPG-MAILKEYS(1) 					      General Commands Manual						   GPG-MAILKEYS(1)

NAME
gpg-mailkeys - sends emails containing keys to their owners SYNOPSIS
gpg-mailkeys id... DESCRIPTION
gpg-mailkeys sends the owners of the keys listed on the command line a mail each, containing their public key. After signing, you can use this tool to send everyone the new signatures they just got. If you're interested in encrypting the signature before it's sent, in order to verify that the associated address actually belongs to the key owner, you should check out caff OPTIONS
None ENVIRONMENT
NAME Set the name to use when sending messages EMAIL Set the email address to use when sending messages SUBJECT Set the subject of the messages you send TEXT Set the body text of the messages SENDMAIL_ARGS Set arguments to pass to /usr/sbin/sendmail. This can be useful to set credentials in order to authenticate to an smtp server when using ssmtp for example. FILES
The behavior of gpg-mailkeys can be updated through some files available in the user home directory. Thus, ~/.gpg-mailkeysrc allows the user to overwrite the default value for the above environment variables, and any text in ~/.signature will be appended to the end of the body text of the message. SEE ALSO
gpg(1),caff(1) AUTHOR
This manual page was written by Simon Richter <sjr@debian.org>. Nov 23, 2010 GPG-MAILKEYS(1)
All times are GMT -4. The time now is 04:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy