0

I'm trying to run a one script file in mesos in background by using nohup command trying, but unfortunately the problem is the script executing successfully but the same scripts spanning as multiple jobs and running all jobs in background.

How can I handle the jobs with out spanning multi jobs, restrict a single jobs after scaling the application in marathon.

**marathon_sample.json**

{
  "id": "/dps/sample",
  "cmd": "nohup sh /tmp/marathon_test/marathon_sample.sh & >> /tmp/marathon_test/marathon_test.log",
  "cpus": 0.1,
  "mem": 512,
  "disk": 1,
  "instances": 0,
  "container": null,
  "constraints": [
    [
      "hostname",
      "LIKE",
      "(lltws0gbeot.sdi.corp.bankofamerica.com)"
    ]
  ],
  "portDefinitions": [
    {
      "port": 0,
      "protocol": "tcp",
      "name": null,
      "labels": null
    }
  ]
}

**marathon_sample.sh**

#! /bin/sh
while [ true ] ;
do
echo 'Hello Marathon test application'
sleep 5 ;
done

Can any one help me to run "marathon_sample.sh" in mesos as a background job.

Charan Adabala
  • 181
  • 2
  • 10

1 Answers1

1

What's the point of running nohup in Marathon? Marathon (resp. Mesos) is supposed to be the "init system" responsible for keeping your job alive and running. You should simplify the command to:

"cmd": "sh /tmp/marathon_test/marathon_sample.sh",

Logs from stdout and stderr are automatically being stored into task's workdir. There's no point to write out of your workdir.

Tombart
  • 30,520
  • 16
  • 123
  • 136