i have several tasks which i need to be executed from time to time …
some every 20 minutes and some only 1 time a day … you know things like
e.g. clearing old sessions, deleting inactive users …
how do you deal with stuff like this? cronjobs? how is your pattern for
such things … thanks in advance
i have several tasks which i need to be executed from time to time …
some every 20 minutes and some only 1 time a day … you know things like
e.g. clearing old sessions, deleting inactive users …
how do you deal with stuff like this? cronjobs? how is your pattern for
such things … thanks in advance
If you need to schedule recurring tasks that are related with a ruby on
rails application you are building then you should go with the
backgroundrb plugin for rails. You can easily schedule tasks but the
best part is that the tasks will have full access to the rails
environment.
It really depends on what you guys are trying to do. I know that is said
alot but it is true. There are certain jobs where a cron job might be
the best (simple jobs such as clearing the session, removing cruft,
simple system stuff)
Script/runner is simple but it is nice because it is built into rails.
The runner script simply loads the rails environment and then executes
some simple ruby code (either a simple ruby statement or a filename).
On the plus side, it is the simplest choice. Some downsides are that
multiple versions of the script might be running side by side which
needs to be accounted for or could be pretty harmful (backgroundrb
queues up tasks by default).
there are certain jobs where backgroundrb daemons are the best choice
(jobs where you are performing actions requiring access to the rails
environment, models, library, etc) and also passing parameters or
wanting tasks to queue up, etc.
Tell me what you want to do and I can try to help recommend the best
course of action.
thanks for the quick comparison … what i want to achieve is the
following
i want to get rid of unused sessions
delete records of several tables where one column indicates that the
record has expired
last but not least those tasks should be configurable within my
application (e.g. which task to execute when) if possible
Nathan E. wrote:
It really depends on what you guys are trying to do. I know that is said
alot but it is true. There are certain jobs where a cron job might be
the best (simple jobs such as clearing the session, removing cruft,
simple system stuff)
Script/runner is simple but it is nice because it is built into rails.
The runner script simply loads the rails environment and then executes
some simple ruby code (either a simple ruby statement or a filename).
On the plus side, it is the simplest choice. Some downsides are that
multiple versions of the script might be running side by side which
needs to be accounted for or could be pretty harmful (backgroundrb
queues up tasks by default).
there are certain jobs where backgroundrb daemons are the best choice
(jobs where you are performing actions requiring access to the rails
environment, models, library, etc) and also passing parameters or
wanting tasks to queue up, etc.
Tell me what you want to do and I can try to help recommend the best
course of action.