Lately I run Firefox almost exclusively from on one of my Debian laptops (which run testing). Occasionally (~monthly) my desktop/tty7 hangs, in which case I usually can goto tty1 and
sudo shutdown -[whatever] now . Unfortunately this does not cause Firefox to shut down as cleanly as I'd like: notably, when I bring it back up after OS restart, I must restore a crashed session. Which usually is not a problem, but sometimes is.
ISTM, for this usecase, I should be able to utter something (before shutdown) from tty1 to tell Firefox to shutdown cleanly. I know what to tell Emacs, but not what to tell Firefox. How to do this? FWIW, the following do not work:
killall -HUP firefox1
When I do that in (the bash terminal @) tty1, and goto tty7, Firefox is indeed gone. But when I restart Firefox (in tty7), Firefox comes up with dialog title=
Session Manager - Restore after Crash and offers a crashed session.
killall -SIGHUP $(pidof firefox)
(Note: I substituted
$() for the backticks used in the candidate answer below to make Markdown happy, but when I ran from tty1, I used the backticks, though I'm quite sure
bash does not care.) This does not work at all for me, but I'm not sure why: when I do the following in tty1,
$ killall -SIGHUP `pidof firefox` 24586: no process found $ pidof firefox 24586 $ pgrep -l firefox 24586 firefox
... and then goto tty7, Firefox is still there.
pkill -HUP firefox
Results identical to item#=1 above.