How to check mailx on unix? | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

How to check mailx on unix?

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 08-10-2010
kailash19 kailash19 is offline
Registered User
 
Join Date: Apr 2010
Last Activity: 4 March 2012, 5:52 AM EST
Location: Pune, INDIA
Posts: 33
Thanks: 4
Thanked 0 Times in 0 Posts
How to check mailx on unix?

Hello,

I need to check if mailx utility is available or not on certail unix hosts.
I am trying to do that by a script, but dont how to check the mailx command .

I did

Code:
mailx -e

but the return status is 1, if no mails ,but thst means its running.
So how can i diffrentiate that mailx was not run or run.
Sponsored Links
    #2  
Old 08-10-2010
pludi's Avatar
pludi pludi is offline Forum Advisor  
Cat herder
 
Join Date: Dec 2008
Last Activity: 28 March 2014, 8:35 AM EDT
Location: Vienna, Austria, Earth
Posts: 5,522
Thanks: 38
Thanked 335 Times in 308 Posts
Whats wrong with
Code:
mailx_path=$( which mailx )
if [ ! -z "${mailx_path}" -a -e "${mailx_path}" -a -x "${mailx_path}" ]
then
    echo "mailx available at ${mailx_path}"
else
    echo "mailx not available"
fi

Sponsored Links
    #3  
Old 08-10-2010
kailash19 kailash19 is offline
Registered User
 
Join Date: Apr 2010
Last Activity: 4 March 2012, 5:52 AM EST
Location: Pune, INDIA
Posts: 33
Thanks: 4
Thanked 0 Times in 0 Posts
Thanks for reply.
What is the -e option?

I tried it gives error "unknown test operator"

I am on HP-UX

---------- Post updated at 09:23 AM ---------- Previous update was at 09:03 AM ----------

Also , mailx is present and is executable, it is just that sometimes it doesnot run and return with error.

So , i need to check if mailx command is running or not.
    #4  
Old 08-10-2010
methyl methyl is offline Forum Advisor  
Advisor
 
Join Date: Mar 2008
Last Activity: 18 April 2014, 5:13 AM EDT
Posts: 6,396
Thanks: 287
Thanked 672 Times in 642 Posts
Quote:
So , i need to check if mailx command is running or not.
This is gibberish.
Pludi's response is quite correct to the question posed.

Please re-phrase in good English stating what you actually want to know.

Also, are all your hosts HP-UX ?

There is a whole lot of difference between mail (whether the command is "mail" "mailx" or whatever) working within a local server and mail working to external servers.

Last edited by methyl; 08-10-2010 at 10:57 AM.. Reason: Also ...
Sponsored Links
    #5  
Old 08-10-2010
kailash19 kailash19 is offline
Registered User
 
Join Date: Apr 2010
Last Activity: 4 March 2012, 5:52 AM EST
Location: Pune, INDIA
Posts: 33
Thanks: 4
Thanked 0 Times in 0 Posts
Yes, all my hosts are HP-UX.

I mean is my mailx running fine(able to send mails or read).

I will be checking all hosts every 10mins(through cron), so cant send mails to a mailID every time for all the hosts, to check mailx.
Sponsored Links
    #6  
Old 08-10-2010
methyl methyl is offline Forum Advisor  
Advisor
 
Join Date: Mar 2008
Last Activity: 18 April 2014, 5:13 AM EDT
Posts: 6,396
Thanks: 287
Thanked 672 Times in 642 Posts
Can we assume that you have a number of servers where the mail normallly works, and you need to know whether the mail is still working?

Let's home in a bit more:

What version(s) of HP-UX?

Are you definitely using "sendmail" for your mail transport?

Checking the entire mail service every 10 mins is paranoia for an Operating System which can work reliably for years. What sort of faults have you experienced which might make you want to do this?

We do run a basic monitor from cron every 15 mins to check count the number of mail items in /usr/spool/mqueue . On this busy machine should the count exceed 50 we raise an alert.
Sponsored Links
    #7  
Old 08-10-2010
kailash19 kailash19 is offline
Registered User
 
Join Date: Apr 2010
Last Activity: 4 March 2012, 5:52 AM EST
Location: Pune, INDIA
Posts: 33
Thanks: 4
Thanked 0 Times in 0 Posts
Yes, you are right.

The version is 11.23, we use sendmail.

We have seen this type of errors:
"can not write to queue directory /var/spool/clientmqueue/ (RunAsGid=0, required=114): Permission denied."

We have our daily logs being mailed from diff servers to a distro(or some specific mailID's), we are seeing that sometimes some servers not able to mail.
We found after investigating that its b'coz mailx didnt work.

Now we need a laert which can inform if on some machines mailx is not working so we an ask someone to fix it(Support team).
There are more than 300 servers.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Check EOF char in Unix. OR To check file has been received completely from a remote system alexalex1 UNIX for Advanced & Expert Users 5 07-22-2010 07:48 PM
Bcc in mailx command in Unix jmathew99 Shell Programming and Scripting 2 05-11-2010 01:42 AM
I could not receive the mail sent from the unix server using 'mailx' little_wonder Shell Programming and Scripting 1 07-08-2009 03:07 PM
Unix mailx question. nshah UNIX for Dummies Questions & Answers 5 01-08-2009 04:16 PM
Aix Unix Mailx Attachments darioa AIX 3 01-07-2009 12:09 PM



All times are GMT -4. The time now is 06:43 AM.