General Question

suketa's avatar

How to use cron in ruby on rails (2.3.5). Please help?

Asked by suketa (2points) March 7th, 2011

Can anyone please guide through website links or books names or any other medium. I am pursuing a project on the same platform. There is one procedure in which I have to set the schedule certain data and such that it automatically send the data to third party on the respective scheduled dates. I have to do the whole scheduling part through cron so that sending data on the scheduled dates job done by it.
please help in this concern as I don’t have idea how to do these.

Observing members: 0 Composing members: 0

1 Answer

robmandu's avatar

At the UNIX prompt, type man crontab and help documentation will appear.

Crontab is the interface you use to schedule jobs in cron. It launches a basic text editor – usually vi but anything you want – and you enter in one line per scheduled job in the cron file. A line there might look something like:

56 4 23 1 * /path/to/shell_script_to_run_ROR.sh

Which means: at 04:56 on January 23, regardless if it’s M-F, execute the program at /path/to/shell_script_to_run_ROR.sh.

If you wanted something to run every Monday at 12 midnight:

00 00 * * 1 /path/to/run_something.sh

Where the 1=Monday. For the other days of the week 0=Sunday and 6=Saturday.

Again, see the man page for more details, options, and examples.

One more thing, a cron file cannot have any blank lines in it. Also, if anything is wrongly formatted, then none of the scheduled jobs may be able to run. You can start a line with the pound sign, #, for comments, like so:

# This is my crontab
#————————————————————-
#
# Run some maintenance every Wednesday night at 9:30pm.
30 21 * * 3 /path/to/maintenance.sh
#
#————————————————————-

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther