Skip to content

dekellum/iyyov

Repository files navigation

Iyyov

Description

Down-to-earth job control and monitoring.

Features

  • Runs on JRuby (no fork or native code extensions)

  • Powerful ruby-based configuration inspired by God

  • Simplified gem packaged daemon launching and monitoring (via Hashdot, others)

  • Log rotation with daemon SIGHUP support

  • Fixed and periodic time job scheduling (basic cron replacement)

    • Threaded asynchronous support with mutual exclusion for long running scheduled jobs

  • Configuration file monitoring and reload support

    • Automatic daemon restart on upgrade or other changes

Synopsis

Iyyov can be tested in the foreground with (-d)ebug logging:

% iyyov-fg -d jobs.rb

See gem or source config/ directory for sample/runnable configurations. Sample jobs.rb configuration:

Iyyov.context do |c|

  c.define_daemon do |d|
    d.name     = "hashdot-test-daemon"
    d.version  = "~> 1.0"
    d.log_rotate do |l|
      l.max_size_mb = 256
    end
  end

  c.schedule_at( :name => "hello", :period => 3.0 ) do
    puts "hello every 3.0 seconds"
  end

  c.schedule_at( :name => "fixed",
                 :fixed_times => %w[ 00:01 12:02 ] ) do
    puts "Fixed time task"
  end

end

Daemon support

The simple form of the define_daemon creates an Iyyov::Daemon based on the following conventions:

  • The required name is used as the default gem name as well and default init script name.

  • Most all set attributes may be lambda’s.

  • If a version is specified, the default Daemon.exe_path will be an init script with the same name and provided by the same named gem and highest matching version.

  • In any case, the Daemon.exe_path should itself demonize and create a PID file in order to be monitored. Hashdot provides reliable means of achieving this.

Setup

Besides creating one or many jobs.rb scripts, you will want to arrange for iyyov to be started on system boot. There are several ways to achieve this:

  • UNIX init.d script (a CentOS/Fedora version is provided in gem or source config/init.d directory)

  • inittab or upstart (which also supports monitoring/restarting iyyov itself)

  • Crontab (an example is provided at gem or source config/crontab)

Iyyov itself contains a Hashdot annotated init/iyyov script used by the above provided examples.

License

Copyright © 2010-2017 David Kellum

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at:

www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Down-to-earth job control and monitoring.

Resources

Stars

Watchers

Forks

Packages

No packages published