I have a script (myscript.rb) like below:
require 'daemons'
Daemons.run_proc 'myproc', dir_mode: :normal, dir: '/path/to/pids' do
# Daemon code here...
end
So, I can check the daemon's status in console by ruby myscript.rb status
.
But I need to show the daemon's status in a web page (Rails), like:
<p>Daemon status: <%= "Daemon status here..." </p>
How can this be done?
In my tests seems like "status" command exits with non-zero value when the daemon is not running:
So it is possible to programmatically check the daemon status as below: