From: Glen Holcomb Date: 2008-05-07T05:14:36+09:00 Subject: Re: Win32 Service Problem ------=_Part_23835_15554415.1210104874794 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Nope, same error message. Here is the current code: require 'rubygems' require 'win32/service' require 'chronic' require 'win32ole' include Win32 $stderr.reopen("C:\\Documents and Settings\\itstaff\\Desktop\\sandman_error.log", "w") logfile = File.new("C:\\Documents and Settings\\itstaff\\Desktop\\sandman_log.txt", "w") logfile.puts Win32::Service::VERSION logfile.close class Daemon def service_init mgmt = WIN32OLE.connect("winmgmts:{impersonationLevel=impersonate,(Shutdown)}//") wmi_results = mgmt.ExecQuery("select * from Win32_OperatingSystem") end def service_main while running? if Time.now < Chronic.parse('today 10:00pm') sleep(Chronic.parse('today 10:00pm') - Time.now) for target in wmi_results target.Win32Shutdown(1) end else sleep(Chronic.parse('tomorrow 10:00pm') - Time.now) for target in wmi_results target.Win32Shutdown(1) end end end end end Daemon.new.mainloop I wasn't sure about the scope with service_init and service_main was going to figure that out later, but it won't even get that far. The version output from this file is 0.6.1 On Tue, May 6, 2008 at 1:45 PM, Daniel Berger wrote: > > > On May 6, 1:25 pm, "Glen Holcomb" wrote: > > I tried a clean install of Ruby and everything on a machine that was > > recently set up. I still get the same error so I'm pretty much out of > > ideas. > > Try Daemon.new.mainloop. > > However, I'm still very confused by this. Try logging the version > number to a file to make sure you're using the version you think > you're using. > > Regards, > > Dan > > -- "Hey brother Christian with your high and mighty errand, Your actions speak so loud, I can't hear a word you're saying." -Greg Graffin (Bad Religion) ------=_Part_23835_15554415.1210104874794--