Install a Windows server made with Ruby


#1

Hello everybody !

I’ve got this problem : my boss asked me to install 3 Windows Services
made with Ruby on a new computer, because he wants to replace the one
witch is actually in use.

I found the Ruby files on the old computer (the service installer and
the services themselves), installer Ruby on the new one like it is on
the old one (same gems,…)

I used the cmd to install the services, everything thing seems to be ok.

I checked the services list, the new service is in it. But I can’t start
it. I’ve got an Error 1067 (process stopped unexpectedly)

I would like to know if you had ideas to solve my problem. Do I have to
look the gems I’m using ? Do I need to use another Windows Service
installer ?

Thanks to give me things to solve this problem…

If you need some more informations, please ask !

Thanks

Alex


#2

I would like to know if you had ideas to solve my problem. Do I have to
look the gems I’m using ? Do I need to use another Windows Service
installer ?

Try to run it from the command line first?
-=r


#3

Roger P. wrote:

I would like to know if you had ideas to solve my problem. Do I have to
look the gems I’m using ? Do I need to use another Windows Service
installer ?

Try to run it from the command line first?
-=r

Do you mean like :
C:\Program Files\ruby\bin\rubyw.exe “C:\Program
Files\RR_outils\FileHandler\FileHandler.rb” -=r


#4

Nobody for an idea ?

Or maybe somebody can explain me how to install a windows service
without Ruby ?


#5

Alexandre Stehlin wrote:

Roger P. wrote:

I would like to know if you had ideas to solve my problem. Do I have to
look the gems I’m using ? Do I need to use another Windows Service
installer ?

Try to run it from the command line first?
-=r

Do you mean like :
C:\Program Files\ruby\bin\rubyw.exe “C:\Program
Files\RR_outils\FileHandler\FileHandler.rb” -=r

yeah, or
C:\Program Files\ruby\bin\ruby.exe “C:\Program
Files\RR_outils\FileHandler\FileHandler.rb”

just to make sure the program doesn’t die.
perhaps the win32-service gem would allow you to create a service that
redirects its stdout+stderr to somewhere so you could see the output.
Good luck.
-=r


#6

just to make sure the program doesn’t die.
perhaps the win32-service gem would allow you to create a service that
redirects its stdout+stderr to somewhere so you could see the output.
Good luck.
-=r

Hello !
With C:\Program Files\ruby\bin\ruby.exe “C:\Program
Files\RR_outils\FileHandler\FileHandler.rb”, I got this :
Usage: FileHandler [options]
-i, --interactive Run as standalone
-d, --debug Print out debug information
-… (the rest of the commands)

What does “stdout+stderr” mean ?

It means redirect output to a file. Difficult to explain, though this
might help.
http://www.google.com/search?client=safari&rls=en&q=redirect%20stdout%20stderr&ie=UTF-8&oe=UTF-8
Cheers.
-=r


#7

Roger P. wrote:

Alexandre Stehlin wrote:

Roger P. wrote:

I would like to know if you had ideas to solve my problem. Do I have to
look the gems I’m using ? Do I need to use another Windows Service
installer ?

Try to run it from the command line first?
-=r

Do you mean like :
C:\Program Files\ruby\bin\rubyw.exe “C:\Program
Files\RR_outils\FileHandler\FileHandler.rb” -=r

yeah, or
C:\Program Files\ruby\bin\ruby.exe “C:\Program
Files\RR_outils\FileHandler\FileHandler.rb”

just to make sure the program doesn’t die.
perhaps the win32-service gem would allow you to create a service that
redirects its stdout+stderr to somewhere so you could see the output.
Good luck.
-=r

Hello !
With C:\Program Files\ruby\bin\ruby.exe “C:\Program
Files\RR_outils\FileHandler\FileHandler.rb”, I got this :
Usage: FileHandler [options]
-i, --interactive Run as standalone
-d, --debug Print out debug information
-… (the rest of the commands)

What does “stdout+stderr” mean ?

Thanks for your help !


#8

Glen H. wrote:

It is possible to “redirect” but you have to re-open the streams and
point
them to a file.
$stdout = File.open(“C:\out_file”, “w”)

Thanks for the answear !
Where do I have to put the $stdout = File.open(“C:\out_file”, “w”) line
?


#9

On Mon, Apr 20, 2009 at 7:49 AM, Roger P. removed_email_address@domain.invalid
wrote:

Usage: FileHandler [options]
Cheers.
-=r


Posted via http://www.ruby-forum.com/.

It is possible to “redirect” but you have to re-open the streams and
point
them to a file.
$stdout = File.open(“C:\out_file”, “w”)


“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)


#10

Ok, here’s what I got :

  • I first killed and deleted the service from the list :
    “C:\Program Files\ruby\bin\ruby.exe” “C:\Program
    Files\RR_Outils\FileHandler\FileHandler.rb” -k -> Got the message
    “service killed” in the out_file
    “C:\Program Files\ruby\bin\ruby.exe” “C:\Program
    Files\RR_Outils\FileHandler\FileHandler.rb” -d -> Got the message
    “service deleted” in the out_file

  • Then I reinstalled the service :
    “C:\Program Files\ruby\bin\ruby.exe” “C:\Program
    Files\RR_Outils\FileHandler\FileHandler.rb” -i -> Got the message
    “service installed” in the out_file

  • Then I started the service :
    “C:\Program Files\ruby\bin\ruby.exe” “C:\Program
    Files\RR_Outils\FileHandler\FileHandler.rb” -s
    -> Got the message :
    One moment, start pending
    One moment, stopped
    One moment, stopped
    One moment, stopped
    One moment, stopped
    One moment, stopped
    One moment, stopped
    One moment, stopped

If I look in the Services List, the Service FileHandler is Installed,
but not running. If I try to start it, I get the message “Impossible to
start the FileHandler service on the local computer - Error 1067 :
process has stopped unexpectaly”


#11

Thanks for the answear !
Where do I have to put the $stdout = File.open(“C:\out_file”, “w”) line
?

beginning of the script


#12

Alexandre Stehlin wrote:

“C:\Program Files\ruby\bin\ruby.exe” “C:\Program
Files\RR_Outils\FileHandler\FileHandler.rb” -s

Oops, made a mistake in the name of the file : it’s FileHandlerService
that I used…

When I tried “C:\Program Files\ruby\bin\ruby.exe” “C:\Program
Files\RR_Outils\FileHandler\FileHandler.rb” -r (to run the service), the
out_file is empty and I get in this in the cmd window :
C:/Program Files/RR_Outils/FileHandler/FileHandler.rb:408:in ‘load xml’:
Not valid XML-file
from C:/Program Files/RR_Outils/FileHandler/FileHandler.rb:326:in ‘load
config’
from C:/Program Files/RR_Outils/FileHandler/FileHandler.rb:558:in
‘service_init’
from C:/Program Files/RR_Outils/FileHandler/FileHandler.rb:604:in
‘mainloop’
from C:/Program Files/RR_Outils/FileHandler/FileHandler.rb:604:in
‘execute’
from C:/Program Files/RR_Outils/FileHandler/FileHandler.rb:655


#13

On Wed, Apr 22, 2009 at 8:42 AM, Alexandre Stehlin <
removed_email_address@domain.invalid> wrote:

C:/Program Files/RR_Outils/FileHandler/FileHandler.rb:408:in ‘load xml’:

Posted via http://www.ruby-forum.com/.

Sounds like it’s looking for some kind of file on line 408. Maybe the
original author was using an XML file for configuration parameters? I’d
have a look at line 408 in FileHandler.rb


“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)


#14

C:/Program Files/RR_Outils/FileHandler/FileHandler.rb:408:in ‘load xml’:
Not valid XML-file
from C:/Program Files/RR_Outils/FileHandler/FileHandler.rb:326:in ‘load
config’

looks like it’s missing a config file? you might want to also redirect
stderr.
GL.
-=r


#15

I made some tests with the FileHandler, without using it as a service.
That means “C:\Program Files\ruby\bin\ruby.exe” “C:\Program
Files\RR_Outils\FileHandler\FileHandler.rb” -r (to run the service)

I found the error in the xml file, there was a “<” missing.

I run the service and I get this in the out_file :


Script FileHandler.rb

Stop with CTRL-C


Sleeping… - idle for 5 sec.
… 5
… 4
… 3
… 2
. 1
Working…

Again and again… But it doesn’t work. I created an “in” folder and an
“out” folder for the tests, but my file stays in the “in” folder. The
problem is not comming from the ruby file because it’s working on the
old computer.

Also, I don’t understand this : “you might want to also redirect
stderr”. Is it something like the out_file ? Where can I found this file
?

Thanks !


#16

Ok thanks !

Now, I can install and start/stop the service, no more “1067 error” !

But the file handler is not working… I set an input and output folder
in the xml config, but the file stays in the “in” folder…

Any idea ?


#17

Working…

Again and again… But it doesn’t work. I created an “in” folder and an
“out” folder for the tests, but my file stays in the “in” folder. The
problem is not comming from the ruby file because it’s working on the
old computer.

Also, I don’t understand this : “you might want to also redirect
stderr”. Is it something like the out_file ? Where can I found this file

So apparently it’s not working?
stderr is
$stderr = File.open(“C:\out_file”, “w”)
GL.
-=r


#18

Alexandre Stehlin wrote:

Ok thanks !

Now, I can install and start/stop the service, no more “1067 error” !

But the file handler is not working… I set an input and output folder
in the xml config, but the file stays in the “in” folder…

Any idea ?

permissions issue? I assume it doesn’t work from the command line


#19

Roger P. wrote:

permissions issue? I assume it doesn’t work from the command line
No I checked this…

And Ruby seems to work correctly because it creates a yaml file from the
xml file when I run the filehandler


#20

Alexandre Stehlin wrote:

Roger P. wrote:

permissions issue? I assume it doesn’t work from the command line
No I checked this…

And Ruby seems to work correctly because it creates a yaml file from the
xml file when I run the filehandler

the daemon might be being run with different permissions?