[ 
https://issues.apache.org/jira/browse/MESOS-4812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15245931#comment-15245931
 ] 

haosdent commented on MESOS-4812:
---------------------------------

{quote}
What you have to send to Mesos is
/bin/bash -c \"</dev/tcp/$HOST/$PORT0\"
{quote}

Actually this is not true. You know I use C++ here, and I have to add \, just 
like why you need add \ in json
{code}
command.set_value("bash -c \"</dev/tcp/$HOST/$PORT0\"");
{code}
If I don't add \, compile would failed. Because
{code}
command.set_value("bash -c "</dev/tcp/$HOST/$PORT0"");
{code}
is illegal C++ sytnax.

As you see, 
{code}
"bash -c \"</dev/tcp/$HOST/$PORT0\""
{code}
would become the string
{code}
bash -c </dev/tcp/$HOST/$PORT0
{code}
in C++.

Anyway, do you mind try my task definition in your side?
{code}
{
        "id": "/test-health",
        "cmd": "sleep 200",
        "healthChecks": [{
                "protocol": "COMMAND",
                "command": {
                        "value": "bash -c \"</dev/tcp/www.google.com/80\""
                },
                "gracePeriodSeconds": 300,
                "intervalSeconds": 60,
                "timeoutSeconds": 20,
                "maxConsecutiveFailures": 3,
                "ignoreHttp1xx": false
        }]
}
{code}

I sure it would running correctly in my marathon. If you not convenience at 
this, I would like to send you a video to prove this.

> Mesos fails to escape command health checks
> -------------------------------------------
>
>                 Key: MESOS-4812
>                 URL: https://issues.apache.org/jira/browse/MESOS-4812
>             Project: Mesos
>          Issue Type: Bug
>    Affects Versions: 0.25.0
>            Reporter: Lukas Loesche
>            Assignee: haosdent
>              Labels: health-check
>
> As described in https://github.com/mesosphere/marathon/issues/3333
> I would like to run a command health check
> {noformat}
> /bin/bash -c "</dev/tcp/$HOST/$PORT0"
> {noformat}
> The health check fails because Mesos, while running the command inside double 
> quotes of a sh -c "" doesn't escape the double quotes in the command.
> If I escape the double quotes myself the command health check succeeds. But 
> this would mean that the user needs intimate knowledge of how Mesos executes 
> his commands which can't be right.
> I was told this is not a Marathon but a Mesos issue so am opening this JIRA. 
> I don't know if this only affects the command health check.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to