[ILUG] Script Query
Ian
ianhoweire at gmail.com
Sun Apr 6 12:52:12 IST 2008
Cheers Colm,
Killall should do the trick. nice to have the other option also.
As for the terminal opening when launching firefox.
I'm actually running the sh script within the shell itself, perhaps this is
why the shell also remains running after firefox opens. Is there a way I can
supress this?
I don't expect to be running the script this way when i have everything
written so it may not be a problem down the road.
Ian
On 06/04/2008, Colm Buckley <colm at tuatha.org> wrote:
>
> On Sun, Apr 6, 2008 at 12:29 PM, Ian <ianhoweire at gmail.com> wrote:
>
>
> > I'm basically launching a program in the background using a sh script.
> >
> > firefox http://www.google.ie
> >
> > (side note: this also launches the terminal, is there a way to prevent
> > this?)
>
>
> It *shouldn't* launch a terminal, to be honest, unless your environment
> decides that it needs somewhere to put the output of the command. What
> environment is this (KDE, GNOME, etc?) and what are you using to launch the
> shell script?
>
> then i want to have another script that can kill the process.
> > I presume i am only able to kill the process using the pid using the
> > format
> > 'kill 1234'
> > I can use the following line to copy the pid to a file
> >
> > ps -e | grep firefox-bin | cut -d ' ' -f2 > ~/processID
> >
> > how then can i pass the entry in processID to the kill command.
> > Or if there is another way to do this i''m all ears.
>
>
> killall firefox-bin
>
> Or, if you really do want to do it using the above:
>
> kill `ps -e | grep firefox-bin | cut -d ' ' -f2`
>
> Note the backticks. Most modern shells will also allow $(), so:
>
> kill $(ps -e | grep firefox-bin | cut -d ' ' -f2)
>
> will also work. killall is easier, though. Note : I believe the Linux
> killall has different semantics from the Unix one; if you run killall on
> (eg:) a Solaris system, it will send a signal to all processes, not just the
> named ones.
>
> Colm
>
>
>
>
> >
> >
> > Ian
> > --
> > Irish Linux Users' Group mailing list
> > About this list : http://mail.linux.ie/mailman/listinfo/ilug
> > Who we are : http://www.linux.ie/
> > Where we are : http://www.linux.ie/map/
> >
>
>
>
> --
> Colm Buckley / colm at tuatha.org / +353 87 2469146
More information about the ILUG
mailing list