I'm doing some automation with Firefox and although I can open Firefox window from shell, I'm not able to terminate it properly. If I kill
Firefox process with kill -3
or kill -2
command the next time I open a new Firefox window it asks me if I want to run in safe-mode. I understand that calling kill -9
could confuse Firefox so it would try to run in safe-mode but -3
should be fine.
Do you have any idea how to gently tell Firefox to close properly?
You can use pkill
with the process name:
pkill -f firefox
For Firefox in OSX:
killall 'firefox'
How about
wmctrl -c "Mozilla Firefox"
?
Is it what you want?
NOTEs:
In Mac OS X, you could use AppleScript to close it (adjust the application name as necessary; I don't have FireFox installed to test):
$ osascript -e 'tell application "FireFox"
quit
end tell'
This should trigger the same event that the Quit menu command triggers, so FireFox should shut down cleanly.
Obviously, this won't work in Linux.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With