Project

schedulero

0.0
No commit activity in last 3 years
No release in over 3 years
Super simple scheduler that will run tasks every x seconds/minutes/hours
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Simple scheduler

Runs tasks in intervals

Example

  • state_file: where to keep the state? defaults to ./tmp/schedulero.json
  • log_file
    • String: ./log/custom...
    • FalseClass: no log
require 'schedulero'

# s = Schedulero.new state_file: "./tmp/schedulero.json", log_file: "./log/schedulero.json", silent: true, state: DRunnerbState
s = Schedulero.new
s.every 'Frequent job', 5 do
  puts '5 seconds passed'
end

# every day
s.every 'Slow job', 1.day do
  puts 'day job ...'
end

# at specfic hour of the day
# will run only once per hour
# at 'At times', 1 do # at 1AM
# midnight and 6 PM
s.at 'At times', [0, 18] do
  p 'BINGO'
end

s.run           # run only once
s.run_forever   # run thread forever

Instalation

gem install schedulero

Run jobs via cron every minute/hour. Jobs will run if needed.

1 * * * * bin/bash -l -c 'ruby /users/me/jobs.rb'

Other info

  • runs tasks in separate threads
  • if the tasks are running before the start, they will be killed
  • logs standard exceptions and runner info to log