hi there
is there's a simple way to find the pid of pd after i've launched it. with the unix ps command, i can find the pid, but can it be done automagically.
many thanks nico
nico bats wrote:
is there's a simple way to find the pid of pd after i've launched it. with the unix ps command, i can find the pid, but can it be done automagically.
You can store the process id in a variable if you start a program asynchronously from a script. For example here is part of my ~/.xinitrc
# start window manager /usr/bin/fluxbox & $wmpid=$!
# launch programs here asynchronously
# wait for window manager to exit wait $wmpid
You could use pdsend to send the pid to pd after a short delay (enough time for Pd to start and load the patches that will receive the pid).
hi you're right, with this line /usr/local/bin/pd & $wmpid=$!
i've got the pid number of pd in the terminal i'll test how to deal with the variable....
many thanks nico
You can store the process id in a variable if you start a program asynchronously from a script. For example here is part of my ~/.xinitrc
# start window manager /usr/bin/fluxbox & $wmpid=$!
# launch programs here asynchronously
# wait for window manager to exit wait $wmpid
You could use pdsend to send the pid to pd after a short delay (enough time for Pd to start and load the patches that will receive the pid).
On Tue, 19 Jul 2005, nico bats wrote:
you're right, with this line /usr/local/bin/pd & $wmpid=$!
eeee, you mean without the $ in front of wmpid ???
because, in Bash syntax, $ means substitution (as it is also in Tcl and Pd syntaxes)
,-o--------o--------o--------o-. ,---. irc.freenode.net #dataflow |
| The Diagram is the Program tm| | ,-o-------------o--------------o-.
-o------------o-------------o-' | | Mathieu Bouchard (Montréal QC) | | téléphone:+1.514.383.3801
---' `-o-- http://artengine.ca/matju -'
yes with $wmpid, i got an error but i got the pid
so how to send the wmpid result in pd (sorry but it's near 6 o'clock in the morning in france.....)
you're right, with this line /usr/local/bin/pd & $wmpid=$!
eeee, you mean without the $ in front of wmpid ???
because, in Bash syntax, $ means substitution (as it is also in Tcl and Pd syntaxes)
On Tue, 19 Jul 2005, nico bats wrote:
so how to send the wmpid result in pd (sorry but it's near 6 o'clock in the morning in france.....)
you can use the pdsend command which may be the Bash equivalent of [netsend] and send this info to a [netreceive] in the patch. Alternatively, you could write the $! to a file and load it using [coll] or something similar.
personally, though, I'd write an external for it:
GridFlow::FObject.subclass("pid",1,1) {def _0_bang() send_out 0,$$ end}
and paste it in ~/.gridflow_startup
then, banging such a [pid] object gives me the pid of the current pd server.
it's also easy using Python.
,-o--------o--------o--------o-. ,---. irc.freenode.net #dataflow |
| The Diagram is the Program tm| | ,-o-------------o--------------o-.
-o------------o-------------o-' | | Mathieu Bouchard (Montréal QC) | | téléphone:+1.514.383.3801
---' `-o-- http://artengine.ca/matju -'
you can use the pdsend command which may be the Bash equivalent of [netsend] and send this info to a [netreceive] in the patch. Alternatively, you could write the $! to a file and load it using [coll] or something similar.
ok
personally, though, I'd write an external for it:
i think i'll try to do my first one for this job..
++ nico
No need to write an external, or use command line parameters, just use the [shell] external from ggee:
"/sbin/getpid pd" | [shell] | "yourpid"
J
On Tue, 2005-07-19 at 05:16 +0200, nico bats wrote:
hi there
is there's a simple way to find the pid of pd after i've launched it. with the unix ps command, i can find the pid, but can it be done automagically.
many thanks nico
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
try "pidof pd"? pat
----- Original Message ----- From: "nico bats" sl1200mk2@gmail.com To: jamie@postlude.co.uk Cc: "PD Lista" pd-list@iem.at Sent: Tuesday, July 19, 2005 3:02 PM Subject: Re: [PD] pid
hi i don't have the getpid program in /sbin otherwise, this solution look simple.
No need to write an external, or use command line parameters, just use the [shell] external from ggee:
"/sbin/getpid pd" | [shell] | "yourpid"
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Try pidof
, that's what I seem to have on my system...
Jacob
On 7/19/05, nico bats sl1200mk2@gmail.com wrote:
hi i don't have the getpid program in /sbin otherwise, this solution look simple.
No need to write an external, or use command line parameters, just use the [shell] external from ggee:
"/sbin/getpid pd" | [shell] | "yourpid"
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Actually that was what I meant. Serves me right for not testing the suggestion. I think getpid does something different and I don't have it either.
Jamie
On Tue, 2005-07-19 at 10:01 -0400, Jacob Last wrote:
Try
pidof
, that's what I seem to have on my system...Jacob
On 7/19/05, nico bats sl1200mk2@gmail.com wrote:
hi i don't have the getpid program in /sbin otherwise, this solution look simple.
No need to write an external, or use command line parameters, just use the [shell] external from ggee:
"/sbin/getpid pd" | [shell] | "yourpid"
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
It's a fairly standard util, so you might want try "locate getpid" or failing that, find / -name getpid. If you haven't got it, you could always use:
"ps -o pid -C pd" | [shell] | [route PID] | | "yourpid"
Jamie
On Tue, 2005-07-19 at 15:02 +0200, nico bats wrote:
hi i don't have the getpid program in /sbin otherwise, this solution look simple.
No need to write an external, or use command line parameters, just use the [shell] external from ggee:
"/sbin/getpid pd" | [shell] | "yourpid"