Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 49 lines (36 sloc) 0.964 kb
3127140 @winton First commit
authored
1 With PID
2 ========
4ab38af @winton [gem_template] First commit
authored
3
3127140 @winton First commit
authored
4 The simple way to create and monitor a Ruby daemon.
5
6 Works by generating a bash file and executing it instead of doing any Ruby process tricks.
4ab38af @winton [gem_template] First commit
authored
7
085cb14 @winton [gem_template] Updating README
authored
8 Requirements
9 ------------
4ab38af @winton [gem_template] First commit
authored
10
11 <pre>
3127140 @winton First commit
authored
12 sudo gem install with_pid
4ab38af @winton [gem_template] First commit
authored
13 </pre>
14
3127140 @winton First commit
authored
15 Ruby script
16 -----------
4ab38af @winton [gem_template] First commit
authored
17
31290fc @winton README
authored
18 ### /data/my_app/current/bin/dj
085cb14 @winton [gem_template] Updating README
authored
19
20 <pre>
3127140 @winton First commit
authored
21 #!/usr/bin/env ruby
22
23 require 'rubygems'
24 require 'with_pid'
25
26 with_pid(
27 :action => ARGV[0], # start or stop
28 :command => "/data/my_app/current/script/runner 'Delayed::Worker.new.start'",
29 :name => "dj",
30 :pid => "/var/run/dj/dj.pid",
31 :tmp => "/data/my_app/current/tmp",
32 :user => "deploy"
33 )
085cb14 @winton [gem_template] Updating README
authored
34 </pre>
35
3127140 @winton First commit
authored
36 Be sure to run <code>chmod +x /data/my_app/current/bin/dj</code>.
085cb14 @winton [gem_template] Updating README
authored
37
3127140 @winton First commit
authored
38 It is up to you to make sure that the command you execute runs in a continuous loop.
085cb14 @winton [gem_template] Updating README
authored
39
3127140 @winton First commit
authored
40 Monit
41 -----
085cb14 @winton [gem_template] Updating README
authored
42
3127140 @winton First commit
authored
43 <pre>
44 check process delayed_job
45 with pidfile /var/run/dj/dj.pid
46 start program = "/data/my_app/current/bin/dj start"
47 stop program = "/data/my_app/current/bin/dj stop"
48 group delayed_job
49 </pre>
Something went wrong with that request. Please try again.