Ruby on Windows questions

(Berger, Daniel) #1

From: Joe Van Dyk [mailto:joevandyk@gmail.com]
Sent: Tuesday, August 22, 2006 12:17 PM
To: ruby-talk ML
Subject: Ruby on Windows questions

Gotta port some software to Windows... :frowning: I'm a Windows newbie.

Using Ruby on Windows (XP)....

1. How do I find out the CPU % (or some sort of a load
indicator) of the machine?

Either use sys-cpu (on the RAA) or use your own custom script using a
combination of win32ole + wmi. See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/
wmi/win32_processor.asp

2. How do I find out how much of a given ethernet connection
is being used? (i.e. if it's a gigabit connection and 1Mbps
are being used, I'd like to get back "1%".

Again, win32ole + wmi. I think you want
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/
wmi/win32_networkadapter.asp

3. Starting programs into the background is done the same
way as on *nix, right?

No. See the 'start' command for launching background processes from the
shell. Use services for everything else.

4. How can I tell how much of a CPU a program is currently using?

Same as #1 above?

5. How do I start a Ruby program at boot (a service)?

Yes, a service would be best.

6. Can I use something like ruby2exe to package up my Ruby service?

I've never tried it but I don't see why not. There's no real need,
however, as you can install services on remote windows machines,
assuming you have permissions. See win32-service.

7. Does Windows use signals? How can I tell a program that
I've started to stop (i.e. on *nix, I'd do it via SIGTERM or SIGKILL).

Windows does events, not signals. Use Process.kill to stop a program.
Preferably the Process.kill defined in win32-process.

8. Any known issues with DRb and Windows?

On that topic I cannot say.

Regards,

Dan

This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.

···

-----Original Message-----