Skip to main content

Scheduled Cron Jobs with the Whenever Gem Discussion

General • Asked by Chris Oliver


I've used the gem but know I understand it a bit more. Just one question. The flags -l and -c in "...bin/bash..." are crontab flags or bash flags?

Thanks a lot!

Those would be flags for bash, not cron itself. -l helps make sure your command for runs in a login shell so everything runs as expected and -c just says "hey we're passing the command through as an argument instead of running a script.

Could this be used in some way so that if a user were signed in to an app, and wanted to configure some sort of email notification to go out after a certain time after an event, or similarly set some sort of scheduled date/time to send out an email? I'm guessing having a cron to run every minute which would trigger a script to check for such a schedule or delayed send?

Hi, I have just created arask to be an effortless way to regularly run tasks in Rails. Just like cron. Much easier to set up though.

For anyone who wants to use Models in tasks, you should load your environment on your task to load them before using them on the code as in:

task example: :environment do

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.