Tuesday, October 27, 2015

KillChrome.bash

It's been a while since I've posted here, but I've got a little trick for the Linux users today.

If you're using Chrome on Linux you may have noticed situations where Chrome doesn't open properly. It reports  "Your profile could not be opened correctly".

Some resources on the web tell you that your profile is corrupt, but that's actually the least likely reason. More likely, you've got abandoned processes that have possession of the file. All you have to do is terminate the processes. The bad news is, there are often a lot of them, so it's tedious to do manually without logging out of the user account. The good news is that it's simple from the command line, and therefore simple to script.

Make a text file (mine's called killchrome.bash), paste this into it, then save:
#!/bin/bash
pkill -9 chrome
google-chrome
Modify the file properties to be executable. You can do this in GNOME by right-clicking the file and editing properties, or you can do it oat the command line like this:
chmod +x killchrome.bash
If you like, you can assign it an icon. The image here is the one I use.

That's it. The next time Google hangs on startup, you don't even have to exit the program. Just click killchrome. It will clear out all the zombies and re-start the program.