LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-08-2016, 06:40 PM   #1
halfmoonhalf
LQ Newbie
 
Registered: Sep 2016
Posts: 2

Rep: Reputation: Disabled
how to set timeout for mailx


Hi all,
newbie here.
I am using Heirloom mailx 12.4 in centos 6.6
sometimes i find that when I send email though mailx it just freezes for more than a minute before giving a timeout error.
My question is: How to set send email timeout to 3 sec?
thanks!

ps: I have been searching for a full guid for setting up ~/.mailrc configuration file and never make it... Any hint will be much appreciate. I went through "man mailx" and it doesn't seem to discuss much about the conf file, does it?
Thanks!
 
Old 09-08-2016, 07:28 PM   #2
halfmoonhalf
LQ Newbie
 
Registered: Sep 2016
Posts: 2

Original Poster
Rep: Reputation: Disabled
this might be a walkaround

this might be a walkaround:
timeout 3 bash -c "echo "body" | mailx -S sendwait -s "title" name@gmail.com"

1. sendwait
manul: When sending a message, wait until the mail transfer agent exits before accepting further commands. If the mail transfer agent returns a non-zero exit status, the exit status of mailx will also be non-zero.
My thinking: so sendwait is to ask mailx to do email sending in only one process instead of starting a child process. I think only in this way the "timeout" control is meaningful or else "timeout" is only checking the wrapping program. is this correct?

2. the command works but it is better to use
timeout 3 bash -c "echo 'body' | mailx -S sendwait -s 'title' name@gmail.com"
the thing I dont quit understand is how does the double-quote inside double-quote work in this command?
I can only find this in "man bash":
-c string If the -c option is present, then commands are read from string. If there are arguments after the string, they are assigned to the positional parameters, starting with $0.
Can anybody explain more on this?

3. I use bash -c because there is pipe inside the mail command. Is this the only solution for piping?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Set default return address for all mails sent from mailx thesunlover Linux - Networking 1 11-13-2012 08:12 AM
[Mailx] Connection timeout InvalidPacket Linux - Software 2 01-26-2012 03:02 PM
How to set TCP Timeout xenomage Linux - Networking 5 11-23-2009 05:08 PM
set reply to address on mailx hamish Linux - Newbie 3 05-31-2005 03:28 AM
How to set timeout value in Konqueror mldqj Linux - Software 1 04-03-2004 05:42 PM


All times are GMT -5. The time now is 08:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration