Linux script question

massahwahl

VIP Member
On my media center I have a radio tuner that I created a desktop icon to start and tune to my favorite station. The script looks like this:

ivtv-radio -f 101.7

which works great, except I have no way to kill it when Im done listening. What command can write to kill the radio when im done?
 
What is the process called? You can write another script to kill it

Code:
#!/bin/bash

radio=`ps -A | grep <processname> -c`

if [[ $radio == 1 ]]

   then killall <processname>

   else echo "radio not playing"

fi

exit
done

Of course you may have to tweak it but that would be a way to kill the process via another script.
 
ivtv-radio uses aplay to output the sound. You should be able to ctrl-c it as well if you run it from a shell window.
 
Last edited:
ivtv-radio uses aplay to output the sound. You should be able to ctrl-c it as well if you run it from a shell window.

OK, so if you replace <process name> with aplay then my script should technically work. The syntax may be a bit different as I write all my scripts for Unix systems mostly.
 
Back
Top