Skip to content

Instantly share code, notes, and snippets.

@eltiare
Created April 6, 2011 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eltiare/906623 to your computer and use it in GitHub Desktop.
Save eltiare/906623 to your computer and use it in GitHub Desktop.
Bash script to use the Rails' runner action via cron
#!/bin/bash
cd `dirname $0`/../
rails runner script/${1}.rb
@eltiare
Copy link
Author

eltiare commented Apr 6, 2011

You use this like so:

/path/to/your/app/script/runthis.sh script-name

I don't like putting the .rb on the end of things, so I made it that way in the script. FWIW, I also drop the .sh extension on the file name on my local projects. Ruby scripts must reside within the script folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment