I need to run a standalone ruby script as Unix (linux) daemon.
After running that daemon I need to run another Ruby method with it.
I installed the ruby-daemon
gem on my machine by using the gem install daemon
.
I did the test daemon program.
My test.rb file is :
module Test
def test_method
@s =" ITS WORKING !"
file=File.new("/home/username/test.txt", "w")
file.puts @s
file.close
end
end
My test_control.rb file is :
# this is myserver_control.rb
require 'rubygems' # if you use RubyGems
require 'daemons'
Daemons.run('test.rb')
After this I run the following command: ruby test_control.rb start
Now how can I check whether the daemon program has started properly?
How can I invoke a method with it?