Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

work on daemon - do not use (Still no work properly)

  • Loading branch information...
commit 907893fffd5d62c7006f646753a6bf314dcd530c 1 parent b0ff16d
miaoufkirsh miaoufkirsh authored
5 README.md
Source Rendered
... ... @@ -1,4 +1,5 @@
1   -# OpenplacOS: Home automation for your system #
  1 +# OpenplacOS: Home automation for your system # [![Build Status](https://secure.travis-ci.org/openplacos/openplacos.png?branch=unstable)](http://travis-ci.org/openplacos/openplacos)
  2 +
2 3
3 4 ## Presentation ##
4 5
@@ -142,4 +143,4 @@ Type:
142 143 * `status` to have a top level report of your system
143 144 * `list` to have all objects and corresponding interfaces
144 145 * `get <object> <iface>` to make a read access on specified object and interface
145   -* `set <object> <iface> <value>` to set an interface of an object to a specified value.
  146 +* `set <object> <iface> <value>` to set an interface of an object to a specified value.
4 server/WebServer.rb
@@ -196,8 +196,8 @@ class WebServer < Sinatra::Base
196 196 class ThinServer < Thin::Server
197 197
198 198 def initialize(bind,port)
199   - @pid_file = "#{File.dirname(__FILE__)}/opos-deamon.pid"
200   - @log_file = "#{File.dirname(__FILE__)}/opos-deamon.log"
  199 + @pid_file = "#{File.dirname(__FILE__)}/opos-daemon.pid"
  200 + @log_file = "#{File.dirname(__FILE__)}/opos-daemon.log"
201 201 super(bind,port, :signals => false) do
202 202 use Rack::CommonLogger
203 203 use Rack::ShowExceptions
4 server/main.rb
@@ -227,15 +227,15 @@ def quit(top_, internalmain_)
227 227
228 228 # start the WebServer
229 229 if options[:deamon]
230   - server.daemonize()
  230 + server.daemonize
231 231 end
232 232
233 233 server.start!
234 234
235   -
236 235 top.components.each { |c|
237 236 if !c.thread.nil?
238 237 c.thread.join
239 238 end
240 239 }
241 240
  241 +
4 test/config_rspec.rb
@@ -9,8 +9,8 @@ def run_one_test(config_)
9 9 end
10 10
11 11 def kill_server
12   - if File.exist?("#{File.dirname(__FILE__)}/../server/opos-deamon.pid")
13   - Process.kill("INT",File.read("#{File.dirname(__FILE__)}/../server/opos-deamon.pid").to_i)
  12 + if File.exist?("#{File.dirname(__FILE__)}/../server/opos-daemon.pid")
  13 + Process.kill("INT",File.read("#{File.dirname(__FILE__)}/../server/opos-daemon.pid").to_i)
14 14 end
15 15 sleep 0.5 # wait the server is down
16 16 end
5 test/server.rb
@@ -2,6 +2,7 @@
2 2 require 'json'
3 3
4 4 class Server
  5 + DAEMON_FILE = "#{File.dirname(__FILE__)}/../server/opos-daemon.pid"
5 6 def initialize(str_)
6 7 @arg = str_
7 8 @status = false
@@ -16,8 +17,8 @@ def launch
16 17
17 18 # Kill the server
18 19 def kill
19   - if File.exist?("#{File.dirname(__FILE__)}/../server/opos-deamon.pid")
20   - Process.kill("INT",File.read("#{File.dirname(__FILE__)}/../server/opos-deamon.pid").to_i)
  20 + if File.exist?(DAEMON_FILE)
  21 + Process.kill("INT",File.read(DAEMON_FILE).to_i)
21 22 end
22 23 end
23 24

0 comments on commit 907893f

Please sign in to comment.
Something went wrong with that request. Please try again.