Topic: Daemon won't start after being initialized
Ok, breaking down my earlier problem of creating a Windows service into just creating the daemon part first can anyone explain to me why this program won't even start??
I stuck a load of put commands in there for debugging and the output generated is as follows:
In Service Main
Which says that when queried the state after init has run is STOPPED, why?
class XmlReader < Daemon
# Give the service time to get everything initialized and running,
# before we enter the service_main function.
#xml = REXML::Document.new(File.open("dataIn.xml"))
puts 'In Service Main'
fileCount = 0 # Initialize the file counter for the rename
watchForFile = "c:\\findme.txt"
p 'state: ' + state.to_s
if state == CONTINUE_PENDING
p 'contin pend'
elsif state == PAUSE_PENDING
p 'pause pend'
elsif state == PAUSED
elsif state == RUNNING
elsif state == START_PENDING
p 'start pend'
elsif state == STOP_PENDING
p 'stop pend'
elsif state == IDLE
elsif state == STOPPED
if state == RUNNING
if File.exists? watchForFile
fileCount += 1
File.rename watchForFile, watchForFile + "." + fileCount.to_s
msg = "Received stop signal at: " + Time.now.to_s
msg = "Received pause signal at: " + Time.now.to_s
msg = "Received resume signal at: " + Time.now.to_s
p 'run daemon'
d = XmlReader.new
rescue Exception => err
p 'ERROR ' + err
This is driving me crazy! lol