Skip to content

Instantly share code, notes, and snippets.

@arturaz
Created September 7, 2011 20:51
Show Gist options
  • Save arturaz/1201690 to your computer and use it in GitHub Desktop.
Save arturaz/1201690 to your computer and use it in GitHub Desktop.
Skype guardian - kill memhungry skype processes
#!/bin/bash
while true; do
mem_used=$(ps aux | grep -P "\bskype\b" | grep -v grep | awk {'print $5'})
mem_limit=$((1024 * 512)) # 512mb
if (("$mem_used" >= "$mem_limit")); then
killall -9 skype
notify-send -i error "Skype was killed because it reached $mem_limit KB limit"
fi
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment