Board index » kylix » Re: start on browser and finish browser

Re: start on browser and finish browser


2003-11-07 06:48:09 AM
kylix1
viviane lima - * - * - wrote:
Quote
I am construct a kiosk software, and I want start the browser Ok.

But, how I finish the browser? I try kill the process but I use libc.kill
and kill all (browser and software)

thanks for any helps
You will want to find out first the process ID (PID) of the program
you want to kill. You may use ps -d | grep mozilla by name to
extract all the PIDs related to the program and go from there..
 
 

Re:Re: start on browser and finish browser

I am construct a kiosk software, and I want start the browser Ok.
But, how I finish the browser? I try kill the process but I use libc.kill
and kill all (browser and software)
thanks for any helps
Vivian
 

Re:Re: start on browser and finish browser

viviane lima - * - * - wrote:
Quote
ok
but, how I use this command in Kylix ?
In Kylix finding the PID can be done in *many* different ways. One,
it would be by use of the GetProcessListByName() function or "better"
process the output of "ps" inside your application, by using the
popen() function and by storing the output in a string lists and
further process each of the string by extracting the PID numbers, so
finally you could use them to kill the processes . Alternatively,
you could duplicate all of this, essentially, in a small shell script
using pipes and run it from your Kylix application.( popen(), system()
etc..)
It is important to kill all of the associated process of the
application, so you could probably use something along this line of
reasoning: First use the "ps" to get a list of running processes you
are intreated in "ps -d" and then pipe it to the grep "| grep mozilla"
which will find all the processes associated with the name "mozilla"
finally, piping the grep output and extracting the the relevant PID
numbers from the list using "| cut -c1-6" and then killing it one by
one using a simple for loop..
#!/bin/bash
for tokill in `ps -d | grep mozilla | cut -c1-6`
do
kill $tokill
done
Also, you could create an "universal killer" which will accept a
parameter ( a name of program to be kill). For example if you will
name this below script "mykiller" then command like "mykiller
mozilla" would kill all associated processes with containing the
string "mozilla".
#!/bin/bash
# universal killer, use program name as parameter.
for tokill in `ps -A | grep $1 | cut -c1-6`
do
kill $tokill
done
juliusz
--
InstallMade - Kylix-specific installer -builder
www.superobject.com/installmade/
Packages: tar.gz, self-installable, RPM, LCR,
and compressed standalone executables.
www.superobject.com/download/
 

{smallsort}

Re:Re: start on browser and finish browser

ok
but, how I use this command in Kylix ?
thanks
Vivian
"juliusz" < XXXX@XXXXX.COM >escreveu na mensagem
Quote
viviane lima - * - * - wrote:
>I am construct a kiosk software, and I want start the browser Ok.
>
>But, how I finish the browser? I try kill the process but I use
libc.kill
>and kill all (browser and software)
>
>thanks for any helps



You will want to find out first the process ID (PID) of the program
you want to kill. You may use ps -d | grep mozilla by name to
extract all the PIDs related to the program and go from there..