Visit Our UNIX and Linux User Community


Check sendmail is not receiving any emails


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Check sendmail is not receiving any emails
# 1  
Old 02-23-2005
Question Check sendmail is not receiving any emails

Hi all,
Need some advise again. I am new to sendmail service which is already configured by some other administrators. I would need to write a script to check whether sendmail service is enabled in Solaris and Linux.
Using this command "ps -ef | grep sendmail | grep -v grep".
Or is there any better command?
The above command will give me a line with "-q15m".

The problem is i need to check that this service is only for delivering emails and Not for receiving any emails.
How do i go about writing the script for Solaris and Linux?

Thank you in advance for some advice.
# 2  
Old 02-23-2005
Any help from somebody?
# 3  
Old 02-23-2005
Dear Kinki,

Please do not "bump up" your posts. This is a rule violation. Thank you.

As far as your question, here is the code I use in the crontab file for sendmail to make sure it *IS* running:

Code:
www# cat checksendmail
#!/usr/bin/perl

open(PS,"/bin/ps x|") || die "Can't Open PS";
while(<PS>) {
if (/sendmail: accepting/) { close PS; exit;}
}
close PS;
system("/usr/lib/sendmail -bd -q5m");

You can easily modify my little script to make sure sendmail is *NOT* running....

Neo
# 4  
Old 02-24-2005
Hi Neo,
Thank you for your reply. Sorry, i don't understand the word "bump up", do u mean my second reply? So sorry..

Sorry i don't use perl in my script. Just ordinary #!/bin/sh.

What is the alternative commands in this case?
# 5  
Old 02-24-2005
Dear Kinki,

I do not use #!/bin/sh in scripts for over 8 years, maybe longer.

Personally, I like more powerful scripting languages.

Having said that, you should easily be able to write one yourself - the same way we all learned, by trial-and-error.

Neo
# 6  
Old 02-24-2005
hmm, what does PS referring to in the command?
# 7  
Old 02-24-2005
Is is simply the name of a file descriptor.

You man find this on your system with the command:

man perlintro

Code:
 You can open a file for input or output using the "open()" function.  It's
       documented in extravagant detail in perlfunc and perlopentut, but in
       short:

           open(INFILE,  "input.txt")   or die "Can't open input.txt: $!";
           open(OUTFILE, ">output.txt") or die "Can't open output.txt: $!";
           open(LOGFILE, ">>my.log")    or die "Can't open logfile: $!";


Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sendmail Fails to send emails from Linux server.

I m using free zoho mail client application (similar to microsoft outlook) on my mobile for all my emails to mohtashim@techx.com I wish to only recieve emails from my Linux Server details of which are: techx 3.10.0-514.10.2.el7.x86_64 #1 SMP CentOS release 7.3.1611 (Core). I try the below... (20 Replies)
Discussion started by: mohtashims
20 Replies

2. AIX

Sendmail daemon is inactive, but still i can send emails

Hi, I did setup sendmail on one of AIX LPARs. Its working as expected. But, would like to clarify something with you all. I stopped the sendmail daemon on AIX LPAR, now it is inactive(&commented it on /etc/rc.tcpip ). But still, am able to send the emails even after stopping daemon. ... (6 Replies)
Discussion started by: system.engineer
6 Replies

3. Linux

Sendmail takes too long to start and the host is unable to send emails

Hello All, Sendmail takes too long to start and the host is unable to send emails, below are the steps followed, Please let me know if I'm missing anything, is there a debug mode for mailx? # time service sendmail restart Shutting down sm-client: Shutting... (6 Replies)
Discussion started by: lovesaikrishna
6 Replies

4. UNIX for Advanced & Expert Users

mailx Vs sendmail to send internal emails to exchange

Hi Gurus, I have been searching for this around, but sendmail seems complicated and not sure if "mail" command would do, since all what I need to send internal emails from my solaris 10 box to our exchange server. Would the mailx or mail command do ? I tried the : # mailx -s test... (2 Replies)
Discussion started by: aladdin
2 Replies

5. Solaris

How to check the number of emails sent out from the Solaris server

Our solaris are configured to send out email and i would like to know the number of emails sent out from the solaris server. Anyone know can this be done? Thanks (1 Reply)
Discussion started by: sirius20d
1 Replies

6. Red Hat

Sendmail fails receiving mail since the IP changed on Redhat Server

Hi, Since i move my Linux Redhat server on another Network with new IP address. WE'RE ABLE TO SEND MAIL OUTSIDE BUT we can not receive any incoming mail. It alway points to the old IP. I updated new IP in /etc/hosts and /etc/sysconfig/network then reboot the system. 10.117.32.20 is an old ip... (3 Replies)
Discussion started by: lamoul
3 Replies

7. Programming

how to check port binding in pcap receiving program?

hi, I am writing one packet receiving program using libpcap library. Now, I want to check port is already using or not. how to check in receiver program.. If normal program, bind return value we can able to check the port using or not. but, in pcap program how can i check? thank... (1 Reply)
Discussion started by: ram.sj
1 Replies

8. UNIX for Dummies Questions & Answers

run a perl.script upon receiving an email in Sendmail

Hi All I am newbie with Sendmail and Linux in general. We use sendmail for outgoing and incoming mails. Once our server receives a certain email xxx@yyy.com we would like to run a PERL script doing some task wiht it. Can you address me a little bit on that topic? In order to do that the... (0 Replies)
Discussion started by: manustone
0 Replies

9. AIX

sendmail only sends emails to its own domain

Hi, folks! I have a problem with an AIX 5.3 server running sendmail where it is able to send messages within its own domain just fine. This is being used for a web email service portion of a web site. However, when it attempts to send email to any other domain -- i.e., hotmail.com -- it... (3 Replies)
Discussion started by: jjwood64
3 Replies

10. UNIX for Advanced & Expert Users

Help me in receiving,validating emails and save them in local directory

hi, I'm working on a project where I get mails from different customers, what I need to do is I need to check if it is genuine mail and if there is any attachment I need to validate them and extract the message and save in the local directory as a text file say and then I need to direct it to... (4 Replies)
Discussion started by: sudharsanc
4 Replies

Featured Tech Videos