Forum: Ruby Install a Windows server made with Ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Alexandre S. (Guest)
on 2009-04-15 16:28
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
Roger P. (Guest)
on 2009-04-15 19:16
> 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
Alexandre S. (Guest)
on 2009-04-15 19:45
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
Alexandre S. (Guest)
on 2009-04-20 11:06
Nobody for an idea ?

Or maybe somebody can explain me how to install a windows service
without Ruby ?
Roger P. (Guest)
on 2009-04-20 11:10
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
Alexandre S. (Guest)
on 2009-04-20 11:51
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 !
Roger P. (Guest)
on 2009-04-20 17:49
>> 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&...
Cheers.
-=r
Glen H. (Guest)
on 2009-04-20 18:42
(Received via mailing list)
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)
Alexandre S. (Guest)
on 2009-04-22 17:20
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
?
Roger P. (Guest)
on 2009-04-22 18:00
> Thanks for the answear !
> Where do I have to put the $stdout = File.open("C:\\out_file", "w") line
> ?

beginning of the script
Alexandre S. (Guest)
on 2009-04-22 18:25
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"
Alexandre S. (Guest)
on 2009-04-22 18:42
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 <Runtime Error>
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
Glen H. (Guest)
on 2009-04-22 19:49
(Received via mailing list)
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)
Roger P. (Guest)
on 2009-04-22 21:01
> C:/Program Files/RR_Outils/FileHandler/FileHandler.rb:408:in 'load xml':
> Not valid XML-file <Runtime Error>
> 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
Alexandre S. (Guest)
on 2009-04-23 11:13
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 !
Roger P. (Guest)
on 2009-04-23 17:21
> 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
Alexandre S. (Guest)
on 2009-04-23 17:50
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 ?
Roger P. (Guest)
on 2009-04-24 13:45
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
Alexandre S. (Guest)
on 2009-04-24 15:44
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
Roger P. (Guest)
on 2009-04-24 15:59
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?
Alexandre S. (Guest)
on 2009-04-24 16:01
Roger P. wrote:
> 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?

Where can I find the deamon permissions?
Glen H. (Guest)
on 2009-04-24 18:18
(Received via mailing list)
On Fri, Apr 24, 2009 at 6:01 AM, Alexandre Stehlin <
removed_email_address@domain.invalid> wrote:

>
> Where can I find the deamon permissions?
> --
> Posted via http://www.ruby-forum.com/.
>
>
This is becoming more of a Windows specific thread than a Ruby specific
one.
 That being said you can make a service run as a specific user, I don't
remember the details though, you have to right click somewhere in the
service list I think.

--
"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)
This topic is locked and can not be replied to.