Created
January 14, 2010 14:49
-
-
Save lukeredpath/277216 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# if you have lib/scripts/do_something.rb | |
# you might run: | |
# script/runner lib/scripts/do_something.rb | |
# but now you can do: | |
# script/daemon lib/scripts/do_something.rb (run|start|stop|restart) | |
require File.join(File.dirname(__FILE__), *%w[.. config environment]) | |
require 'daemons' | |
script = ARGV.shift | |
Daemons.run(script, :dir_mode => :normal, :dir => Rails.root + "tmp/pids") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment