Why chrome reacts after receiving kill-stop signal, and how to prevent that?

Posted on

Problem :

I am trying to save my laptop’s battery by pausing/stopping completely chrome from doing stuff while minimized by manually sending it a kill-stop signal.
When I did that, I pressed CTRL+T to test if chrome can create a tab when it is stopped, chrome didn’t react with creating a new tab, but I noticed that the title of the window changed from my current tab name to “New Tab”, meaning it still somewhat working.

The line I am using for sending kill-stop signal is sudo kill -STOP $(pidof chrome).

How can I completely stop chrome from consuming CPU time for a period of time, and saving all of my session in-memory (not having to exit and launch it again)? And why the method above didn’t completely work?

Solution :

Looks like pidof is missing some processes, testing it with Chromium on Debian it returns 17 pid’s, while ps ax|grep [path] returns 18 pid’s.

I’d use this instead, after finding chrome’s path with

cpath=`which chrome`

pkill -f -STOP "$cpath"

Taking advantage of pkill’s -f:

-f, –full

The pattern is normally only matched against the process name. When -f is set,
the full command line is used.

Leave a Reply

Your email address will not be published.