Crontab utility for rails

to run any function at periodically in SYSTEM then we can use crontab
tool.
for the same purpose,is there anything into RAILS project ?

BackgroundRB I think can run scheduled tasks.

On Tue, Jun 10, 2008 at 2:55 PM, Pokkai D. <
[email protected]> wrote:

to run any function at periodically in SYSTEM then we can use crontab
tool.
for the same purpose,is there anything into RAILS project ?

Posted via http://www.ruby-forum.com/.


Appreciated my help?
Recommend me on Working With Rails
http://workingwithrails.com/person/11030-ryan-bigg

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 10 June 2008 07:25:04 Pokkai D. wrote:

to run any function at periodically in SYSTEM then we can use crontab
tool.
for the same purpose,is there anything into RAILS project  ?

Your Rails application will include a script/runner script. You can use
it to run (slow-loading) code in the context of your Rails application
from cron jobs. Just remember to set RAILS_ENV=production in the
crontab in production. :slight_smile:

If your jobs must fire frequently, consider something like backgroundrb
instead.

Ciao,
Sheldon.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFITkpzpGJX8XSgas0RAvJVAKCXUGf+DqGr16L3YeoURfIS9WjHcgCfcxYO
CAo0TZv6hbMUaRCWHAVVJko=
=MVCM
-----END PGP SIGNATURE-----

Sheldon H. wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 10 June 2008 07:25:04 Pokkai D. wrote:

Your Rails application will include a script/runner script. You can use
it to run (slow-loading) code in the context of your Rails application
from cron jobs. Just remember to set RAILS_ENV=production in the
crontab in production. :slight_smile:

If your jobs must fire frequently, consider something like backgroundrb
instead.

Ciao,
Sheldon.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFITkpzpGJX8XSgas0RAvJVAKCXUGf+DqGr16L3YeoURfIS9WjHcgCfcxYO
CAo0TZv6hbMUaRCWHAVVJko=
=MVCM
-----END PGP SIGNATURE-----

i thing

sleep(1.hour) inside another Thread

will it give any problem ?

Quoting Sheldon H. [email protected]:

it to run (slow-loading) code in the context of your Rails application
from cron jobs. Just remember to set RAILS_ENV=production in the
crontab in production. :slight_smile:

I’d suggest changing to your application’s home/root directory and then
invoking the function with script/runner. I found the results variable
until
I added the change directory. It has been rock solid ever since. For
example:

3-58/5 * * * * cd /home/jeff/Rails/amethyst; nice ./script/runner -e
development ‘Preload.preload’ &> /dev/null

Runs at 3, 8, 13, 18, … minutes after the hour. Calls the preload()
function in the Preload module in development mode. And drops the
output into
the bit bucket. Leave off the “&> /dev/null” part until you are sure it
is
running without problems. Depending on your setup (e.g. production
vs. development databases) you may wish to run in production mode. It
may run
faster.

HTH,
Jeffrey

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 10 June 2008 13:19:14 Pokkai D. wrote:

sleep(1.hour) inside another Thread

will it give any problem ?

Why in another thread? Just put it in the main loop of your script.

Ciao,
Sheldon.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIT+WvpGJX8XSgas0RAuBCAJ443+P/AMz1pAYfvx8Aw9vc+cTw0wCfT+y/
z3cAUFGlxC+6SyqPyq59rg8=
=OWAd
-----END PGP SIGNATURE-----