Another option (to expand on my second suggestion) would be to compile the
potentially long running script into an exe using rubyscript2exe and then
launch it from another script system("start script.exe") then after five
hours wake up and check the windows process list for script.exe and if it is
running kill it:
wmi =
WIN32OLE.connect("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\\\#{name}\\root\\cimv2")
proc_list = wmi.ExecQuery("select * from win32_process")
proc_list.each do |process|
if process.Name == "script.exe"
process.Terminate(8)
end
end
http://msdn.microsoft.com/en-us/library/aa394372(VS.85).aspx<
http://msdn.microsoft.com/en-us/library/aa394372(VS.85).aspx>
You would of course need to require 'win32ole' for this to work.
--
"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)