I will get a 1053 ERROR. How can I rescue the error?
I suggest you google for “1053 ERROR win32-service ruby”.
You may start the service from the command line (net start foo) to see
if you get an additional debug info.
Then, try running your service in standalone mode (i.e. just run
"D:\Ruby\bin\ruby "+File.expand_path($0))
The error you get might be dependant on OS version (XP/2K3/vista) and
the user it runs under (default is SYSTEM).
There are several constraints what you can and cannot do when running
as service. Most notably, you won’t have access to
stdin/stdout/stderr,
and to any substed/mapped/network disks. The PATH might be different as
well.
Or, you can merge them in one file, but distinguish among them using
command line options.
I mean, if you run my_service --register or my_service --unregister,
then it will to the register/unregister stuff.
Without option, it will run the Daemon stuff.
I will get a 1053 ERROR. How can I rescue the error?
After reading your other thread I see your problem now:
Just make TWO scripts: one for registering the service and the other
for the service itself.
You don’t need to register the service again when it’s just being
started.
Or, you can merge them in one file, but distinguish among them using
command line options.
I mean, if you run my_service --register or my_service --unregister,
then it will to the register/unregister stuff.
Without option, it will run the Daemon stuff.
Note that in order to start the notepad, you might need to allow the
service interact with desktop. (Though
I don’t remember if this is valid for xp or for vista only. Have a
look in the service’s properties.)
One thing you’ll want to be aware of is that there was an interface
change in 0.6.0. Here’s an example that uses most of the available
options:
…
Regards,