This gem provides a CLI and a simple REST API client for Chronos.
Add this line to your application's Gemfile:
gem 'chronos-api', :require => 'chronos'
And then run:
$ bundle install
You have two options to set authentification if your Chronos API requires it:
Chronos.options = {:username => 'your-user-name', :password => 'your-secret-password'}
or
$ export CHRONOS_USER=your-user-name
$ export CHRONOS_PASSWORD=your-secret-password
$ irb
irb(main):001:0> require 'chronos'
=> true
irb(main):002:0> Chronos.options
=> {:username => "your-user-name", :password => "your-secret-password"}
or
$ chronos -c http://USERNAME:PASSWORD@HOST:PORT
To list the current scheduled jobs:
require 'chronos'
jobs = Chronos.list
or
$ chronos list
To add a new job:
require 'chronos'
Chronos.add({
name: 'myjob',
schedule: 'R10/2012-10-01T05:52:00Z/PT2S',
epsilon: 'PT15M',
command: 'echo foobar',
owner: '[email protected]',
async: false
})
or
$ chronos add --job /path/to/job/details.json
To delete a job:
require 'chronos'
Chronos.delete('job_name')
or
$ chronos delete --name job_name
To delete all jobs:
require 'chronos'
Chronos.delete_all
or
$ chronos delete_all
To manually start a job:
require 'chronos'
Chronos.start('job_name')
or
$ chronos start --name job_name
Please fork and send pull request. Make sure to have test cases for your changes.
This gem has been highly inspired by marathon-api.
This program is licensed under the MIT license. See LICENSE for details.