Skip to content

PeterHickman/Crons-for-Rails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Crons
=====

If you have some tasks that need to be run periodically for your
site to function (cron scripts in the unix parlance) then this
plugin will add some tasks to your Rakefile and Capfile to
automate the installation of those scripts when you deploy.

This assumes that you are using a unix like os such as Linux
or OSX and that your cron program understands the Paul Vixie
extensions such as @daily, @weekly etc.

Example
=======

In your scripts directory create the following directories

<app>/scripts/crons
              |----/daily
              |----/weekly
              |----/hourly
              |----/monthly
              |----/other

Place the unix shell scripts or Ruby scripts in the appropriate
directories. You can omit directories that you do not require.

The unix shell scripts will be added to the users crontab so:

@daily (/bin/sh /path/to/app/script/crons/daily/db_backup.sh)

The Ruby scripts will be added to the users crontab so:

@daily (cd /path/to/app ; /usr/local/bin/ruby script/runner -e production script/crons/daily/purge_sessions.rb)

Awkward stuff
=============

Some tasks will not fit into the nice clean hourly, daily, weekly
slots and need to be run at other intervals. You might also need to
set headers in your crontab (if you don't understand don't worry).

To do this the plugin looks for a file <app>/scripts/crons/other.txt
which it will prepend to the crontab. So you can set your headers here
and set the other scripts that will need running.

Put the shell and Ruby scripts that are run from the other.txt file in
the <app>/scripts/crons/other directory for safe keeping

Copyright (c) 2009 Peter Hickman <peterhickman386@googlemail.com>, released under the MIT license

About

Intergrating crons into the deployment of a Rails application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages