I made this little script for my SETI@home instances, so I can just open this script and they will be changed to highest priority when I enter a password:
top -l1 | grep SETI@home | tr -s " " | cut -d" " -f2 | tr "\n" " " > output.txt
sudo renice -20 `cat output.txt`
rm output.txt
I thought this might be valuable here, because you can modify it to kill a program. If you wanted to kill iTunes it would look like this:
top -l1 | grep iTunes | tr -s " " | cut -d" " -f2 | tr "\n" " " > output.txt
kill `cat output.txt`
rm output.txt
If you make this via vi or pico, and save it as "Kill iTunes.command", you can just double click it in the Finder and it will open a new terminal windowm and execute the commands, provided you enter this little modification at the top of the file, so it looks like this:
#!/bin/tcsh
top -l1 | grep iTunes | tr -s " " | cut -d" " -f2 | tr "\n" " " > output.txt
kill `cat output.txt`
rm output.txt
I think a little dose of UNIX a day keeps the computer problems away.
If you guys want to know specifically what this command does and how it does it, just reply.