cron not sending external mails


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting cron not sending external mails
# 8  
Old 12-06-2011
Try executing the script with -x thru cron

Script changes...
Code:
#!/bin/sh
set -x
ifconfig...

Cron entry...
Code:
26 * * * * /home/user/Loadbalancercheck.sh >/tmp/log 2>&1

Paste the output of /tmp/log

--ahamed
# 9  
Old 12-06-2011
Mail log entry for the cronmail can some one pelase explain this

Code:
Dec  6 09:23:00 Hostname sendmail[17484]: pB69N0017484: from=root, size=288, class=0, nrcpts=1, msgid=<201112060923.pB69N0017484@hostname.domain.com>, relay=root@localhost
Dec  6 09:23:00 Hostname sendmail[17484]: pB69N0017484: to=root, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30288, dsn=2.0.0, stat=Sent
Dec  6 09:23:00 Hostname2 sendmail[17484]: pB69N0017484: to=root, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30288, dsn=2.0.0, stat=Sent

# 10  
Old 12-06-2011
Starting a script through cron is not the same as when being started from a shell manually. You should ensure that all binaries etc. are found since you have not the same environment as in your shell. PATH variable and others are not set if you do not set them explicitly.

Here is a general guide to cron with things noted you should take into account:
https://www.unix.com/answers-frequent...n-crontab.html
# 11  
Old 12-06-2011
Quote:
Originally Posted by ahamed101
Try executing the script with -x thru cron

Script changes...
Code:
#!/bin/sh
set -x
ifconfig...

Cron entry...
Code:
26 * * * * /home/user/Loadbalancercheck.sh >/tmp/log 2>&1

Paste the output of /tmp/log

--ahamed
i tried the above, log entry for the cron

Code:
[root@Hostname]# cat /tmp/log22
+ ifconfig -a
/home/user/Loadbalancercheck1.sh: ifconfig: command not found
+ grep 192.168.0.1
+ '[' 1 -eq 0 ']'

---------- Post updated at 09:45 AM ---------- Previous update was at 09:40 AM ----------

Quote:
Originally Posted by zaxxon
Starting a script through cron is not the same as when being started from a shell manually. You should ensure that all binaries etc. are found since you have not the same environment as in your shell. PATH variable and others are not set if you do not set them explicitly.

Here is a general guide to cron with things noted you should take into account:
https://www.unix.com/answers-frequent...n-crontab.html
Thanks a lot realy valuable

---------- Post updated at 09:48 AM ---------- Previous update was at 09:45 AM ----------

Code:
#!/bin/sh
/sbin/ifconfig -a | grep 192.168.0.1
if [ $? -eq '0' ];
then mail -s "subject" user@Domain.com < /home/user/mailmessage.txt
fi

Resolved

code changed

Really helpfull friends
Thank you evry one for your time Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question