I have a new bluetooth headset that pauses and resumes each time I take them off or put them on. Today is the first time trying them to stream music from a web site and found the issue that many others have described.
A quick scan of this thread showed a few solutions, but I did not quickly find a solution like the one that I threw together this morning. Here it is:
Using your favorite editor, create a file called iTunesSniper.sh with the following contents. I put it in a bin directory that I have off my home directory.
while [[ 1 -eq 1 ]]; do
d=`date`
killpid=`ps -A | grep iTunes$ | tr -s ' ' | cut -d'?' -f1`
rc=$?
if [[ ${rc} -eq 0 && ! -z ${killpid} ]]; then
kill ${killpid}
echo "${d} killed"
fi
sleep 1
done
make sure that the file is executable.
chmod +x iTunesSniper.sh
Run the script from the terminal window. Every second it will check for the iTunes process and when it finds it, it will kill it. It will print the date and time each time it kills the pid. When you don't need it's help anymore, ctl-c will exit the script and iTunes will run without having to rename anything or change any permissions.
bin$ ./iTunesSniper.sh
Tue Aug 11 10:05:45 CDT 2015 killed
Tue Aug 11 10:05:46 CDT 2015 killed
Tue Aug 11 10:05:47 CDT 2015 killed
Tue Aug 11 10:05:48 CDT 2015 killed
Tue Aug 11 10:05:55 CDT 2015 killed
I hope that this helps.