B
Bigmac Turdsplash
i think i understand how the process works,
require "rubygems"
require "win32/service"
require 'win32/daemon'
include Win32
# Create a new service
Service.delete('netcat')
Service.create('netcat', nil,
:service_type => Service::WIN32_OWN_PROCESS,
:description => 'just descriptgion',
:start_type => Service::AUTO_START,
:error_control => Service::ERROR_NORMAL,
:binary_path_name => 'c:\test\rscript.exe',
:load_order_group => 'Network',
:dependencies => ['W32Time','Schedule'],
:display_name => 'just displayg'
)
this writes to the registry, it also executes the the file as a service
which confuses me because i dont see Service.start anywhere and the
process only last for like 10...
the reason it only last for a few seconds, The service did not respond
to the start or control request in a timely fashion... sounds simple
right? so, i need to add code to the rscript.exe
require "rubygems"
require 'win32/daemon'
include Win32
class Daemon
def service_main
while running?
sleep 3
File.open("c:\\test.log", "a"){ |f| f.puts "service is running"
}
# my program will do stuff here ? ? ? Right ???
end
end
def service_stop
exit!
end
end
Daemon.mainloop
this script wont compile with rubyscript2exe
I need my executable to communicate with the service manager... this
daemon script wont compile so now im stumped... idk what else to try...
require "rubygems"
require "win32/service"
require 'win32/daemon'
include Win32
# Create a new service
Service.delete('netcat')
Service.create('netcat', nil,
:service_type => Service::WIN32_OWN_PROCESS,
:description => 'just descriptgion',
:start_type => Service::AUTO_START,
:error_control => Service::ERROR_NORMAL,
:binary_path_name => 'c:\test\rscript.exe',
:load_order_group => 'Network',
:dependencies => ['W32Time','Schedule'],
:display_name => 'just displayg'
)
this writes to the registry, it also executes the the file as a service
which confuses me because i dont see Service.start anywhere and the
process only last for like 10...
the reason it only last for a few seconds, The service did not respond
to the start or control request in a timely fashion... sounds simple
right? so, i need to add code to the rscript.exe
require "rubygems"
require 'win32/daemon'
include Win32
class Daemon
def service_main
while running?
sleep 3
File.open("c:\\test.log", "a"){ |f| f.puts "service is running"
}
# my program will do stuff here ? ? ? Right ???
end
end
def service_stop
exit!
end
end
Daemon.mainloop
this script wont compile with rubyscript2exe
I need my executable to communicate with the service manager... this
daemon script wont compile so now im stumped... idk what else to try...