wake up to a clean state

I used to have problems when my ultrabook woke up from sleeping mode. Nothing serious, but annoying. One thing was that the empathy messenger application fully occupied one CPU core, effectively transforming the power out of the battery into heat. I grew tired of manually terminate it every time. So I did some research, and put the following lines into  /etc/pm/sleep.d/20_empathy_cpu_hog :

case "${1}" in
    resume|thaw)
        killall empathy-gabble
        ;;
esac

The other problem was the ssh connection that I keep to my server. After waking up from sleep it took a while to time out. Now, I terminate it right after wakeup, so that it can be automatically re-established. To accomplish this , I wrote the following lines into /etc/pm/sleep.d/30_ssh_ulrichard :

#! /bin/bash
case "${1}" in
    resume|thaw)
        kill `ps aux | grep ssh | grep user@server.ch
                 | grep -v grep | awk '{print $2}'`
        ;;
esac

I love linux, where problems are rare, every problem can be solved, and the solution is just a few lines away…


Posted

in

,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *