Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

[Edit: I answered the first half of my issue, so I'll edit this to address the second half.]

/etc/monit/monitrc looks like this:

set mailserver
    smtp.server.net
    port 587
    username "USERNAME"
    password "PASSWORD"
    using tlsv1 with timeout 30 seconds
    using hostname "server.fqdn.com",

    smtp.server2.net
    port 587
    username "USERNAME"
    password "PASSWORD"
    using tlsv1 with timeout 30 seconds
    using hostname "server.fqdn.com"

sudo service monit syntax spits out this:

/etc/monit/monitrc:57: Error: syntax error 'smtp.server2.com'

At first I had the wrong using/with syntax like this:

    using tlsv1
    using hostname "server.fqdn.com"
    with timeout 30 seconds
share|improve this question
    
Typical, immediately after posting, I figured out the answer. The with timeout 30 seconds part belongs to the using tlsv1, so the syntax works like this: using tlsv1 with timeout 30 seconds using hostname "server.fqdn.com" Can I somehow withdraw the question? –  chmac Jan 4 '12 at 16:57
    
Finally worked it out, the with timeout 30 seconds using hostname "server.fqdn.com" need to come at the end of all the mailserver definitions, and they apply to them all. When I RTFM more carefully, I spotted my mistake. –  chmac Jan 4 '12 at 17:18

1 Answer 1

up vote 2 down vote accepted

Typical, immediately after posting, I figured out the answer.

The with timeout 30 seconds part belongs to the using tlsv1, so the syntax works like this:

The correct config turned out to be this:

set mailserver
    smtp.server.net
    port 587
    username "USERNAME"
    password "PASSWORD"
    using tlsv1
    ,
    smtp.gmail.com
    port 587
    username "USERNAME"
    password "PASSWORD"
    using tlsv1

    with timeout 30 seconds
    using hostname "server.fqdn.com"

The with timeout and using hostname declarations come after all the servers have been listed, and they apply to all mailservers in the list. Took me ages to finally figure that out, but it is in the manual if you look closely. The white spacing is optional.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.