Jazzy Coding

The Art of Structured Improvisation. By Carsten Nielsen

Tag Archives: gnome

gnome-shell: reload after freeze

Ok, it happened again.

In a nice productive coding session my gnome-shell unexpectedly freezed. The gnome-session got completely unresponsive… or nearly – I was able to switch to another terminal-session.

Using the top command I was able to see that really the gnome-shell-session was eating memory and cpu-time like hell. But how can I send a gnome-shell-reload-command to another terminal-session? No results after a research on the lazy-web… I had to hard-reset my system reset the gdm-windowmanager – nearly loosing all my unsaved code. (Mainly avoided, lucky as I am with a git commit of the cached files in the coding folder – but that’s another story…)

Hmm – what to do then? I need a method to reset the gnome-shell from another session…

I can’t send any commands to another tty (as far as I know). But hey! The sessions are using the same file system!

As a workaround I wrote a small script that runs under the actual gnome-shell-session, checks the existence of a file every 10 seconds and if this file don’t exist simply reloads the gnome-shell-session.


#!/bin/bash cd ~/.config/gnome-shell-restarter/

while true ;do
if [ -f delete-to-reload-gnome-shell ] ;then
sleep 10;
touch delete-to-reload-gnome-shell;
gnome-shell --replace

As you can see I’ve put the script in the .config folder. I’ve added it to my gnome-autostart by using the “gnome-session-properties” gui-tool.

In case my gnome-shell freezes again, I simply switch to another session with Ctrl-Alt-F1 and delete the “delete-to-reload-gnome-shell” file. Voilá! the gnome-session restarts!

If you have a better solution for this or maybe any hints on gnome-shell, feel free to comment!