1

Is there any way to have a Docker-based service on Marathon restart itself at a given time everyday? What I'd like is a way to say something like "scale to 0 at midnight and scale it to 1 at 6am" or something like that.

On DC/OS there is the notion of jobs but it isn't clear to me whether a job can restart a running service.

Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420
mfirry
  • 3,634
  • 1
  • 26
  • 36

2 Answers2

1

As far as I know Marathon has no such feature, Marathon is used to manage(create/delete/scale/health-check) apps on Mesos cluster as what init process(e.g. Systemd) do for Linux. Scheduled jobs is delegated to other frameworks, scheduled jobs functionality on CS/OS mentioned in your question is provided by metronome, and there's also a sophisticated framework Chronos to do the same thing, as what crontab job for Linux.

Even Marathon has no built-in features like that, it provides rich RESTful APIs, you can easily resolve your problem by using Chronos and Marathon together:

  1. Create a script to stop/start your app through Marathon API
  2. Create Chronos job to run your script at midnight to stop your app
  3. Create Chronos job to run your script at 6AM to start app
shizhz
  • 11,715
  • 3
  • 39
  • 49
0

You can use mesos-chronos for scheduling job.Docker can be scheduled using it.More details at https://mesos.github.io/chronos/

Girdhar Sojitra
  • 648
  • 4
  • 14