#!/bin/bash PLS=http://provisioning.streamtheworld.com/pls/wbapAmAAC.pls URLS=`/usr/bin/wget -q -O - "$PLS"` Rush=/mnt/sda1/MP3/Rush/$(/bin/date +%Y%m%d)_Rush.m4a end=`date +%Y%m%d` end+="135730" /usr/bin/touch /mnt/sda1/rush rm /mnt/sda1/rush for url in $URLS ; do http=`echo "$url" | /bin/grep -Po "(?<=[=])http.*(?=\r)"` if ! [ -z "$http" ]; then /usr/bin/wget -q -O - "$http" >> $Rush & /bin/sleep 2m while [ "$(date +%Y%m%d%H%M%S)" -le "${end}" ] && ! [ -z `/usr/bin/pgrep -f "$http"` ]; do /bin/sleep 1m done if ! [ "$(date +%Y%m%d%H%M%S)" -le "$((end))" ]; then /bin/kill `/usr/bin/pgrep -f "$http"` break fi fi done