Jobber: sophisticated task scheduler

terminalJobber is for people who wish the task scheduler cron had been more powerful. Jobber features some powerful capabilities in addition to those of cron:

  • Job execution history with status.
  • Advanced error handling: control whether and when a job is run again after it fails e.g., after an initial failure of a job, Jobber can schedule future runs using an exponential backoff algorithm.
  • Advanced error reporting: get notified on each failed run or only about jobs that were disabled due to repeated failures.

Jobber is being developed under the MIT license and is in a beta status at the time of writing. It is open source and free.

Installation

Jabber is written in Go. You have to compile Jobber from source to try it out. So you need to have Go installed on your system and your workspace ready. Currently Jabber runs officially on RHEL-like distributions (e.g. Fedora, CentOS). Steps:

$ cd /path/to/your/workspace
$ go get github.com/dshearer/jobber
$ make -C src/github.com/dshearer/jobber
//To install
$ sudo make install -C src/github.com/dshearer/jobber

Use Jobber on Ubuntu

The compilation steps remain the same except the last one. The binaries are generated but make install fails because chkconfig is not used on Ubuntu. It is used to add Jobber as a start-up service on RHEL. To start Jobber service manually on Ubuntu, run:

$ sudo /usr/local/sbin/jobberd start

You can add it to a startup script to run Jobber as a daemon.

Usage

Jobfiles

Each user can define his jobs in a jobfile which is ~/.jobber. Jobfiles are written in YAML format. Here’s a sample:

---
- name: DailyBackup
cmd: backup daily
time: 0 0 13
onError: Backoff
notifyOnError: false
notifyOnFailure: true

- name: WeeklyBackup
cmd: backup weekly
time: 0 0 14 * * 1
onError: Stop
notifyOnError: false
notifyOnFailure: true

where,

name: name of the job
cmd:
 any script
time: [sec] [min] [hr_in_24:00_format] [day_of_month] [month] [day_of_week]
onError: what Jobber will do when a particular job fails (returns non-0 exit status). This field may have any of the following 3 values:
1. Stop: stop scheduling runs of this job. That is, a single job error results in a job failure (Jobber will not schedule any job anymore).
2. Backoff: follow an exponential backoff algorithm. If a later run of the job succeeds, jobber resumes scheduling this job normally; but if the job fails again on several consecutive runs, jobber stops scheduling it i.e., the job fails.
3. Continue: continue scheduling normally.
notifyOnError: Notify if a single job fails. true or false
notifyOnFailure: Notify if Jobber stops scheduling

Commands

  • A single user can reloadhisjobfile using
     $ jobber reload
  • An admin can reload allusers’jobfiles using
    $ sudo jobber reload -a
  • List and view status of jobs
    $ jobber list
    //for all users
    $ sudo jobber list -a
  • List recent runs
    $ jobber log
    //for all users
    $ jobber log -a
  • Run a job immediately
    $ jobber test JOB_NAME

On GitHub: Jobber

Leave a Reply

Your email address will not be published. Required fields are marked *