Is there a way to safely close down Chromium from the command-line?
Use SIGTERM
:
pkill -15 chromium-browser
or:
pkill chromium-browser
the default value is -15
equal to SIGTERM
.
From Wikipedia:
The SIGTERM signal is sent to a process to request its termination. Unlike the SIGKILL signal, it can be caught and interpreted or ignored by the process. This allows the process to perform nice termination releasing resources and saving state if appropriate. SIGINT is nearly identical to SIGTERM.
PS: pkill -3 chromium
was only an illustration of how may a session lost happen.
Related videos on Youtube
Broadsworde
Updated on September 18, 2022Comments
-
Broadsworde over 1 year
Is there a way using
command-line/bash
to safely close down Chromium (running multiple tabs), that will not cause the application to shutdown incorrectly.Using (for example):
$ pkill -3 chromium
(
man signal
shows -3 indicates the signal SIGQUIT)(which I understand is how the shutdown command would terminate an application)
Causes Chromium to give the following error message when you next start it: -
Broadsworde over 5 yearsThanks again @Ravexina. Would you be able to elaborate on the difference between pkilling chromium vs chromium-browser, and why shutdown, reboot and logout are not using this safe termination method in their processes?
-
Ravexina over 5 yearsI'm sure the commands you mentioned are sending the correct SIGNAL, they used to send
SIGTERM
. The Idea withSIGTERM
is that the process (chromium in this case) can decide what to do. Because the system is getting shutdown chromium may decides to inform you that your session suddenly has been lost (Not by you) or it does not have enough time to cleanly close itself and system goes down before it get cleanly shutdown (chromium). My example in your previews question was only intended to reproduce the error. -
Ravexina over 5 years
pkill chromium
may terminate other process which they name containschromium
whilepkill chromium-browser
will only terminate the browser (uniqe name) it's even better to use it likepkill -x chromium-browser
(x
exact name). -
Jaime Hablutzel almost 5 yearsIn Ubuntu 18.04, how could I make this to be executed immediately after triggering a restart or a shutdown?