Taskr is a stand-alone HTTP daemon, providing a cron-like networked scheduling service. Tasks can be created and managed problematically via REST calls over HTTP allowing other REST-aware services to schedule and manage jobs, or manually via a nice web interface.
One common use for Taskr is to schedule jobs to be executed on remote Rails servers. However, Taskr is a far more generic tool, capable of performing a wide range of scheduled actions.
Taskr jobs can be as simple as single-line shell commands (similar to cron), but support is built-in for more complex, higher-level actions. For example, Taskr can be used to place a REST call to another RESTful service, such as sending out a timed message via the Howlr RESTful messaging daemon, or it can be used to execute arbitrary code on a remote Ruby on Rails server via the Taskr4rails plugin.
Behind the scenes, Taskr is written in Ruby using the Camping framework and uses the OpenWFEru-Scheduler.
Screenshot
Taskr's task list shown in the built-in web interface.
Installation
- First you'll need a Ruby interpreter installed along with the RubyGems packaging system.
- Install the Taskr gem:
- Run taskr from the command line. You can add the -h flag to see command line options. Also, on a Linux system you'll probably want to run Taskr as root, since by default is stores its configuration in /etc/taskr and its logs in /var/log/taskr.rb:
- The first time you run the taskr command, Taskr will create a default configuration file for you in /etc/taskr/config.yml and it will then exit. Have a look inside this file and edit it to your needs. Taskr requires a SQL database, and configuration examples are provided for various database servers (MySQL, PostgreSQL, SQLite, etc.).
- Before running taskr again, make sure that the database you've configured is ready to be used. For example, if you're using mysql, you'll have to create the database first:
- You can now run taskr again. You should see it start up, and you should be able to access the web interface at http://localhost:7007/tasks.
- The BuiltInActionTypes page has some info about the various kinds of jobs you can schedule.
gem install taskr
sudo taskr
mysqladmin -u root -p create taskr
Have a look at the Downloads page for further installation and configuration help.
Usage
Taskr has a simple, self-explanatory web interface. This is by default accessible at http://localhost:7007/tasks. The web interface is meant to be intuitive, although you might want to have a look at BuiltInActionTypes for info on the kinds of actions Taskr can be scheduled to execute.
If you're interested in interacting with Taskr programmatically (i.e. via its REST API), have a look at the Documentation section below.
Once you have Taskr configured, you will probably want to run it as a background daemon. This is done using the taskr-ctl script:
taskr-ctl start taskr-ctl status taskr-ctl stop
You can use taskr-ctl to incorporate Taskr into your system as a background service. On Linux for example, you'll want to create an init.d script; have a look at HowToInstallAsaService.
If you encounter errors like "could not obtain a database connection within 5 seconds. The max pool size is currently 5; consider increasing it.", try adding the pool parameter to your database connection config. As a rule of thumb, your pool may need to be at least as big as the maximum number of tasks that are scheduled to execute simultaneously:
database: pool: 10
Documentation
For information about talking to Taskr as a REST web service, have a look at the API and at sample client code for Ruby and PHP.
You'll also probably be interested in the BuiltInActionTypes and their parameters. For integration with Rails (i.e. executing remote code on Rails applications) see Taskr4rails.