Service detection on Windows & ??? platform

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
TheWebGuy
Posts: 3
Joined: Sun Jul 23, 2006 6:10 am

Service detection on Windows & ??? platform

Post by TheWebGuy » Wed Aug 02, 2006 11:41 pm

Hi there,

I'm hoping there's someone here that can help me. I've only recently started using Revolution, so am something of a newbie where it's concerned, although not to programming in general. I've searched through the help and haven't found anything that would specifically address my query.

What I'd like to do is automatically detect if there are any mysql services installed on a Windows (and maybe other) machine, and if so, whether they're running or not.

My approach has been to loop through all registry keys under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ to look for instances where the ImagePath subkey contains text with 'mysql' in it and then work from there.

Where I'm stuck is detection of services/daemons on other platforms. If someone's done this before, I'd appreciate it if they could tell me a bit about how they approached the problem.

Thanks,

Will.

oliverk
Site Admin
Site Admin
Posts: 53
Joined: Mon Feb 27, 2006 2:16 pm
Location: Edinburgh

Post by oliverk » Thu Oct 26, 2006 9:34 am

Hi Will,

On Unix and OS X you can find out whether a service is running by using the unix "ps" command.

If you execute the command "ps -ax", all the processes will be listed, you can filter this list by redirecting the output through the grep command. For example, to search for mysql processes, something like:

get shell("ps -ax | grep mysqld")

should return the information you need. You will need to do a small amount of work in Revolution to get the process ids that you need, and also to filter out the process id of the grep command itself.

Hope this helps.

Regards

Oliver
Oliver Kenyon
Software Developer
Runtime Revolution

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”