2

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?

2
  • Are you sure that Chrome is only one process?
    – DaveP
    Commented Jan 19, 2018 at 14:59
  • @DaveP ipidof returns all processes that contain (or exact match?) the specified name. one or multi-process application is not a problem. Commented Jan 19, 2018 at 15:02

1 Answer 1

2

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.

2
  • which chrome returns nothing, I am using pkill ... chrome instead. Commented Jan 19, 2018 at 16:30
  • which just returns a command's pathname, Maybe chrome isn't in your default path, but it should be visible in the ps ax output to confirm too. Not using the path just avoids unfortunately similar named commands, but probably fine without it.
    – Xen2050
    Commented Jan 20, 2018 at 13:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .