how to use cronjob

hey everyone i want to send mails by scheduling the time
dynamically.lets say in a single table i have all the employee logs
who came at different timings.they are from different locations and
departments. i want to send mails to different mails ids according to
there location to there HR. can i do this with cron job.

thanks in advance

I’ve seen this cast

http://railscasts.com/episodes/164-cron-in-ruby

and it has its revised episode, maybe it helps, or just go to see the documentation of the whenever gem

JavierQ.

A better approach I believe is to use redis/resque to queue the emails
to be sent -- and then use resque-scheduler to schedule the jobs to
run whenever you want them to run.

There are a bunch of reasons why redis is a better approach to queuing
work in general, so I'd look into this.

What you want is:

- redis installed on the machine

- The gems:

resque
resque-mailer
reque-scheduler

Here's a pointer to the current set of resque plugins -- you'll find
the scheduler and mailer plugins described there.
https://github.com/defunkt/resque/wiki/plugins

Good luck.