SWEET!

On 6 July 2010 14:16, <ashok+skunkworks@parliaments.info> wrote:
On Tue, Jul 6, 2010 at 1:32 PM, Geoffrey Mimano <soyfactor@gmail.com> wrote:
>  Problem is that I need to associated the pid to individual process (gotten
> from Runtime.getRuntime().exec("gksu rfcomm connect 0
> 0B:D4:91:39:66:01");)  in the java app. Now since I am using Threading ie.
> the Runtime.getRuntime().exec("
> gksu rfcomm connect 0 0B:D4:91:39:66:01"); is being called within a thread
> many times for the different array of devices that I have set on my machine
> I have to make sure I do not kill a process that has not completed its task.
>


what you need to do is run rfcomm from within a shell script and
invoke the shell script from java  :

gksu rfcomm connect 0 0B:D4:91:39:66:01 &
lastpid=$!
echo "${LASTPID}

$! - returns the pid of the last forked process which in this case is
the rfcomm process ...

to check if its still running you can use pgrep or pipe-filter ps -ax ...
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1fbjAwOUE&hl=en
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke



--
Mimano G. Muthondu,
Software Developer
skype : gmimano
Mobile : +254 723 615 206