Page 1 of 1
How to kill hidden firefox?(Solved)
Posted: Sat 12 Mar 2011, 20:05
by kent41
When I try to open firefox I get a message that firefox is already running and I must kill it or reboot.
I have tried to re-boot but no help. I removed and re-installed firefox and still get message.
I have looked in TOP and do not see firefox running.
I have looked in Pprocess process manager and do not see firefox in there either.
Where else can I look to kill firefox?
I am using puppy 4.3.1 on a 2G usb thumb drive and firefox 3.5.6 on a acer netbook
Posted: Sat 12 Mar 2011, 21:01
by rokytnji
You can try
and see if Firefox will open after that that command.
Posted: Sat 12 Mar 2011, 21:21
by Makoto
Find your Firefox profile directory. It should be ~/.mozilla/firefox/('random' characters), I believe.
In that directory, if there is a file named something like ".lock" and/or ".parent-lock", delete them. Then, try starting Firefox again.
(The files are meant to prevent more than one instance of Firefox from running at a time, basically. However, if FF crashes, the files may not be deleted, and FF will unfortunately think another instance is already running, when there aren't any.)
Re: How to kill hidden firefox
Posted: Sun 13 Mar 2011, 04:23
by RetroTechGuy
kent41 wrote:When I try to open firefox I get a message that firefox is already running and I must kill it or reboot.
I have tried to re-boot but no help. I removed and re-installed firefox and still get message.
I have looked in TOP and do not see firefox running.
I have looked in Pprocess process manager and do not see firefox in there either.
Where else can I look to kill firefox?
I am using puppy 4.3.1 on a 2G usb thumb drive and firefox 3.5.6 on a acer netbook
Open rxvt (command window), and enter:
Note the "firefox-bin", and the number on the left side, for example (from my machine right now):
Code: Select all
14766 root 0:00 /bin/sh /usr/lib/firefox/run-mozilla.sh /usr/lib/firefox/firefox-bin
Now enter:
(Note: "-9" means "Kill it, and I mean RIGHT NOW!!!")
Posted: Sun 13 Mar 2011, 05:15
by kent41
Thanks for all the suggestions however the thumbdrive
seem to have other issues and I found it would be just as easy to re-install.
I deleted the .lock and the .parentlock but that did not help.
I had added lots of changes so now I will have to reload all my changes and updates.
Thanks again
Posted: Sun 13 Mar 2011, 08:30
by Bruce B
I wrote this script quite quickly and tested it. It seems to work fine. If problems let me know.
First we try and be nice to the ghost app, if that doesn't work, we use
signal 9, the ghost buster.
Code: Select all
#!/bin/bash
### MODIFIED to reflect changes
# first kill gently try up to 12x
while [ x$cnt != x11 ]; do
id=`pidof -s firefox`
if [ ! -e $id ] ; then
kill -s 15 $id
fi
idbin=`pidof -s firefox-bin`
if [ ! -e $idbin ] ; then
kill -s 15 $idbin
fi
cnt=`echo $((cnt + 1))`
done
cnt=0
# test and force kill try up to 8x
while [ x$cnt != x7 ] ; do
id=`pidof -s firefox`
if [ ! -e $id ] ; then
kill -s 9 $id
fi
idbin=`pidof -s firefox-bin`
if [ ! -e $idbin ] ; then
kill -s 9 $idbin
fi
cnt=`echo $((cnt + 1))`
done
# test and report
id=`pidof -s firefox`
idbin=`pidof -s firefox-bin`
if [ -e $id ] && [ -e $idbin ] ; then
echo "Success, Firefox isn't running"
else
echo "Sorry, Firefox appears to be running"
fi
Note: All the iterations don't do anything unless there is something to do.
But Firefox has several threads and PIDS.
File attached, unzip it and put in your path, one of the bin directories
File name is
killfox
~
EDIT: the -xs switch didn't work with Puppy's BusyBox pidof. I fixed
the downloadable file by replacing the -xs with just -s and it works
fine.
If you downloaded the killfox.zip file, please download killfox-fixed.zip
to replace the script killfox.
Sorry for the inconvenience.
Note - the script requests Firefox to close several times before
forcing it do close. If Firefox closes on request, it will give a normal
shutdown and likely prevent corrupting Cache or configuration files.
~
Posted: Sun 13 Mar 2011, 17:36
by Moose On The Loose
You can make your script a little faster with
# A=$(( 1 + 1 ))
# echo $A
2
instead of using the echo to do it.
You can also use a for loop like:
Code: Select all
# for A in firefox firefox-bin madeup madeupmore ; do
> echo $A
> done
firefox
firefox-bin
madeup
madeupmore
#
to do more than one program's PID. With seamonkey, I seem to get a total of 3 zombie programs when is crashes. Perhaps with firefox there are only 2.
Posted: Mon 14 Mar 2011, 00:52
by kent41
Thanks Bruce I will add the script to my bag of tricks and the next time Firefox acts up I have a bigger hammer.
Kent
EDIT: for some reason I was getting a x error on pidof - I removed the -x and kept the -s and it works ok now.
Posted: Mon 14 Mar 2011, 09:41
by Bruce B
kent41 wrote:Thanks Bruce I will add the script to my bag of tricks and the next time Firefox acts up I have a bigger hammer.
Kent
EDIT: for some reason I was getting a x error on pidof - I removed the -x and kept the -s and it works ok now.
Two different tools. I used the GNU pidof which supports the -x switch.
-s Single shot - this instructs the program to only return one pid
-x Scripts too - this causes the program to also return process id's of shells running the named scripts
I installed my own Firefox. The name filename
firefox is a script. The name
firefox-bin is a binary file.
Here is the help for Puppy's pidof - note that
-x isn't supported, so
it needs to be removed for that tool. Sorry.
Code: Select all
BusyBox v1.16.2 (2010-06-19 18:02:46 GMT-8) multi-call binary.
Usage: pidof [OPTIONS] [NAME]...
List PIDs of all processes with names that match NAMEs
Options:
-s Show only one PID
-o PID Omit given pid
Use %PPID to omit pid of pidof's parent
~
Posted: Mon 14 Mar 2011, 10:36
by don922
I see the title "How to kill hidden firefox"; will it kill a running firefox or only a "hidden firefox"?
I downloaded killfox and installed it in /root/bin. To test it I open FirePup (firefox 1.5.0.12) and ran killfox. Killfox reported "Success, Firefox isn't running". However, nothing changed with firefox it is running as before.
What is going on?
Edit:
Fixed - reread the comments about removing the pidof -x option and everything works right.
Bruce B posted his answer below while I was doing this edit. He must not sleep!
Posted: Mon 14 Mar 2011, 10:57
by Bruce B
I'm still setting up Puppy 5.20. I think it is because of the x in the
pidof -xs (explained above)
You can remove the -x and make it just -s and try it again. Otherwise, I'll
troubleshoot it for you, if I don't hear back.
~
Posted: Mon 14 Mar 2011, 12:11
by Bruce B
don922 wrote:
Edit:
Fixed - reread the comments about removing the pidof -x option and
everything works right.
Don,
It was the x as I guess you figured out. I uploaded the fixed script also.
Bruce
Thanks to all for their tips and patience.