Forum: Ruby to run window service using 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.
Newb N. (Guest)
on 2009-04-08 08:00
Hi...
how to run window service using ruby.
i have exe file for making it to run i have to click it on.
but i want to make it to run using ruby.

Kindly Help me get along with ruby...

Thank you
Phlip (Guest)
on 2009-04-08 08:11
(Received via mailing list)
Newb N. wrote:
> Hi...
> how to run window service using ruby.
> i have exe file for making it to run i have to click it on.
> but i want to make it to run using ruby.
>
> Kindly Help me get along with ruby...

If by 'window service' you mean the program starts when you turn on your
desktop...

...put the ruby.rb file into your Start menu's Startup folder. Yes it
will open
a little window. You can use rubyw.exe to fix that.

A true "windows service" is like a daemon. You run in a special place
with
limited facilities, and it's generally no picnic for a beginner. I have
run many
desktop apps from the Startup menu, including a lite Ruby wiki for my
PIM, and I
never had any issue with it...
Newb N. (Guest)
on 2009-04-08 08:42
Phlip wrote:
> Newb N. wrote:
>> Hi...
>> how to run window service using ruby.
>> i have exe file for making it to run i have to click it on.
>> but i want to make it to run using ruby.
>>
>> Kindly Help me get along with ruby...
>
> If by 'window service' you mean the program starts when you turn on your
> desktop...
>
> ...put the ruby.rb file into your Start menu's Startup folder. Yes it
> will open
> a little window. You can use rubyw.exe to fix that.
>
> A true "windows service" is like a daemon. You run in a special place
> with
> limited facilities, and it's generally no picnic for a beginner. I have
> run many
> desktop apps from the Startup menu, including a lite Ruby wiki for my
> PIM, and I
> never had any issue with it...


Thanks for the reply...

Actually i run qt program as windows service.

to start and restart i manually give command in the windows command
prompt.

now i would like to know how to run this program using our ruby...

any command or something...

pls help
Vikhyat K. (Guest)
on 2009-04-08 08:46
Newb N. wrote:
> Thanks for the reply...
>
> Actually i run qt program as windows service.
>
> to start and restart i manually give command in the windows command
> prompt.
>
> now i would like to know how to run this program using our ruby...
>
> any command or something...
>
> pls help

You can run any command as if run in a command line using the system
method, like this:

system('command to run')
Newb N. (Guest)
on 2009-04-08 09:02
Vikhyat K. wrote:
> Newb N. wrote:
>> Thanks for the reply...
>>
>> Actually i run qt program as windows service.
>>
>> to start and restart i manually give command in the windows command
>> prompt.
>>
>> now i would like to know how to run this program using our ruby...
>>
>> any command or something...
>>
>> pls help
>
> You can run any command as if run in a command line using the system
> method, like this:
>
> system('command to run')

thanks much..
just curious to know about ruby classes.


Is it possible to run using ruby if so how....

Thanks
Newb N. (Guest)
on 2009-04-08 13:11
Newb N. wrote:
> Vikhyat K. wrote:
>> Newb N. wrote:
>>> Thanks for the reply...
>>>
>>> Actually i run qt program as windows service.
>>>
>>> to start and restart i manually give command in the windows command
>>> prompt.
>>>
>>> now i would like to know how to run this program using our ruby...
>>>
>>> any command or something...
>>>
>>> pls help
>>
>> You can run any command as if run in a command line using the system
>> method, like this:
>>
>> system('command to run')
>
> Now i did start stop and continue and pass the windows service.
but how to Restart a windows service...
What command is needed.

Pls help me
Alexey B. (Guest)
on 2009-04-10 00:39
>> Now i did start stop and continue and pass the windows service.
> but how to Restart a windows service...
> What command is needed.

Have a look at win32-service gem

http://raa.ruby-lang.org/project/win32-service/

If you want to create a service that is written in ruby, then code
sample there is horribly outdated and you will need to read source code
and comments to understand how to do it in the new style. But if you
want to start/stop/restart some other service, then it works just like
on that page. Have a look.
This topic is locked and can not be replied to.