Using SHELL to get a list of processes
Mark Schonewille
m.schonewille at economy-x-talk.com
Thu Feb 5 14:25:25 EST 2009
Hi Hugh,
If you want to run only one instance of your standalone at a time, you
need to include a relaunch handler in your stack script. Assuming that
you want the existing instance to come to the foreground when the
second instance is launched and that you want the second instance to
quit immediately, all you need is to catch the message and not pass it:
on relaunch
return empty -- just for clarity, if you like
end relaunch
If you return "background", the second instance is terminated, but the
first instance won't be activated. If you pass the message, the second
instance will run.
--
Best regards,
Mark Schonewille
Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz
Dutch forum: http://runrev.info/rrforum
We are always looking for new projects! Feel free to contact us to
discuss your custom software project!
On 5 feb 2009, at 19:55, Hugh Senior wrote:
> Goal:
> Using shell()to determine if my Rev app is among the line of all
> running
> processes. If so, then user has started a second instance and I want
> to
> quit.
>
> Task 1: Get a list of all running processes and IDs.
> Task 2: Get the process name and ID of my Rev app.
>
> With me so far? Okay...
>
> I should be able to get a list of all running process using "ps -e"
> (according to http://www.ss64.com/bash/ps.html).
>
> So I try this in the message box, hoping to see some sort of a list:
>
> answer shell("ps -e")
>
> What I get instead is 'ps is not recognised as an internal or external
> command, operable program or batch file.'
>
> Same result using shell("top") and shell("list-processes").
>
> So what stupidity am I doing, please (apart from naively expecting the
> syntax to work)? And how do I get the process name & ID of the app?
>
> /H
More information about the use-livecode
mailing list