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
2004-04-15

      mailping

      0.0.4

MAILPING-CRON(1)						     Mailping							  MAILPING-CRON(1)

NAME
mailping-cron - run periodic processing to test email service availability and functioning SYNOPSIS
mailping-cron DESCRIPTION
mailping-cron processes incoming emails, updates status and sends out probe messages. The idea is to configure multiple email "circuits", send probe messages regularly, and see whether they complete the circuit and how long it took. Setting up a circuit 1. Give a name to the circuit, hereafter referred to as circuit. 2. Arrange for a local email address to be delivered to maildir /var/lib/mailping/state/circuit/incoming/. See mailping-store. 3. Create a configuration for the circuit, by creating directory /etc/mailping/circuit. If you need non-default sender and/or recipient addresses, create files from and to there, containing the sender and recipient addresses suitable for the circuit. 4. You're done! Munin should now see the data. Testing multiple servers To test functioning of more than one email server, arrange an email alias at a remote site pointing to an address on your server, and set the address of that alias here. Here's an example of testing a system consisting of two email servers and everything in that path (smarthosts, primary MXs, virus checkers, etc.): Local address <mailping+that@this.example.com> is delivered with mailping-store to /var/lib/mailping/state/that/incoming/. Remote address <echo@that.example.com> is an alias that redirects all email to <mailping+that@this.example.com>. /etc/mailping/that/to is set to <echo@that.example.com>. FILES
/etc/mailping/circuit/from Sender address for the probe emails. Default: <currentuserid@fullyqualifiedhostname>. /etc/mailping/circuit/to Recipient address for the probe emails. You must arrange for the email to eventually get delivered to the maildir /var/lib/mailping/state/circuit/incoming/. mailping-store will probably be useful in that. Default: <currentuserid+circuit@fullyqualifiedhostname> /etc/mailping/circuit/admin Admistrative address, set as Reply-To in probe messages. Default: do not add Reply-To. /etc/mailping/circuit/interval How often a probe message is sent, in seconds. Default: 600 seconds. /var/lib/mailping/state/circuit/ Stored state for the probing. /var/lib/mailping/state/circuit/junk/ Maildir used to store all messages in incoming that do not look like probe messages. Read and delete them regularly. /var/lib/mailping/state/circuit/broken/ Maildir used to store all messages in incoming that do look like probe messages, but a corresponding pending entry cannot be found. Duplicated probe messages cause these. Read and delete them regularly. ENVIRONMENT
MAILPING_CONFIGDIR Override the location of the configuration directory. Default: /etc/mailping MAILPING_STATEDIR Override the location of the state directory. Circuit states are stored in the state subdirectory of this directory, in subdirectories named after the circuit name. Default: /var/lib/mailping SEE ALSO
mailping-store(1), mailping-success(1), mailping-latency(1) AUTHOR
Tommi Virtanen <tv@havoc.fi> Havoc Consulting Author. COPYRIGHT
Copyright (C) 2004 Havoc Consulting mailping 0. 2004-04-15 MAILPING-CRON(1)
All times are GMT -4. The time now is 03:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy