Created
February 24, 2014 18:43
-
-
Save rafaelcanovas/9194296 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from subprocess import call, check_output, CalledProcessError | |
top_ps = check_output('ps haxo pid,command k -pcpu | head -n 1', shell=True) | |
top_ps = str(top_ps, encoding='UTF-8') | |
top_pid, top_cmd = top_ps.strip().split(' ', 1) | |
try: | |
question = check_output([ | |
'zenity', | |
'--question', | |
'--title', 'Killtop', | |
'--text', 'Tem certeza que deseja matar o processo `%s`?' % top_cmd | |
]) | |
call(['kill', top_pid]) | |
except CalledProcessError: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment