tr333
February 7th, 2009, 07:12 AM
I have the following bash script to play music to an Apple Airtunes device:
#!/bin/bash
IP='192.168.0.250'
VOLUME='-30' # range is -144 to 0
JUSTEPORT='/usr/local/bin/JustePort'
MIME=`file -b -i "$*"`
if [[ "$MIME" = 'audio/mpeg' ]] ; then
mpg123 -s "$*" | $JUSTEPORT - $IP $VOLUME
elif [[ "$MIME" = 'audio/ogg' || "$MIME" = 'application/ogg' ]] ; then
oggdec -Q -R -o - "$*" | $JUSTPORTE - $IP $VOLUME
elif [[ "$MIME" = 'audio/aac' || "$MIME" = 'audio/mp4' ]] ; then
faad -q -w -f 2 "$*" | $JUSTEPORT - $IP $VOLUME
else
echo "Don't know how to handle this filetype, giving up."
exit 1
fi
exit 0
If I run this script from another program, how can I kill the JustePort (mono/cli) process at a later time from the program that ran the bash script? Running 'pidof' could potentially return multiple PIDs if there is multiple mono programs running as all mono programs run under the 'cli' process name. Killing the bash script won't stop the mono/cli process.
#!/bin/bash
IP='192.168.0.250'
VOLUME='-30' # range is -144 to 0
JUSTEPORT='/usr/local/bin/JustePort'
MIME=`file -b -i "$*"`
if [[ "$MIME" = 'audio/mpeg' ]] ; then
mpg123 -s "$*" | $JUSTEPORT - $IP $VOLUME
elif [[ "$MIME" = 'audio/ogg' || "$MIME" = 'application/ogg' ]] ; then
oggdec -Q -R -o - "$*" | $JUSTPORTE - $IP $VOLUME
elif [[ "$MIME" = 'audio/aac' || "$MIME" = 'audio/mp4' ]] ; then
faad -q -w -f 2 "$*" | $JUSTEPORT - $IP $VOLUME
else
echo "Don't know how to handle this filetype, giving up."
exit 1
fi
exit 0
If I run this script from another program, how can I kill the JustePort (mono/cli) process at a later time from the program that ran the bash script? Running 'pidof' could potentially return multiple PIDs if there is multiple mono programs running as all mono programs run under the 'cli' process name. Killing the bash script won't stop the mono/cli process.