Hi,

I've configured the ices package to stream whatever happens to be flowing into 
my sound card line input using this roundabout method (seems to work the best 
given that ices will read from a FIFO but not stdin):

  1. aucat writes line in to FIFO at /dev/aucat/.raw;
  2. lame reads from above and writes to FIFO /dev/lame/.mp3;
  3. ices reads from above and sends to my icecast server.

The following commands in a sh script run from root's shell form the meat of 
the above chain of events:

  /usr/local/bin/lame --quiet -r -a -b 56 /dev/aucat/.raw /dev/lame/.mp3 &
  /usr/bin/aucat -o - > /dev/aucat/.raw &
  /etc/rc.d/ices start

However, if I try to adjust /etc/rc.local to include the first two lines (which 
need to be running before ices gets called by rc_scripts in rc.conf.local), 
aucat refuses to start.

I've also taken the above commands and created a slightly more robust watchdog 
script that is run as a cronjob.

crontab entry: *       *       *       *       *       /root/bin/wd_ices.sh

/root/bin/wd_ices.sh:
--------
#!/bin/sh

AUCAT_PID=`/bin/ps ax|grep -v grep|grep 'aucat -o -'|sed -e 's/^  *//' -e 's/ 
.*  //'`
LAME_PID=`/bin/ps ax|grep -v grep|grep 'lame '|sed -e 's/^  *//' -e 's/ .*//'`
ICES_PID=`/bin/ps ax|grep -v grep|grep 'ices '|sed -e 's/^  *//' -e 's/ .*//'`

if [ "$AUCAT_PID" -eq "" -o "$LAME_PID" -eq "" -o "$ICES_PID" -eq "" ]; then

  echo "ices and/or its streams were not running and were restarted on `date`."

  /etc/rc.d/ices stop
  kill $LAME_PID > /dev/null 2>&1
  kill $AUCAT_PID > /dev/null 2>&1

  sleep 5

  /usr/local/bin/lame --quiet -r -a -b 56 /dev/aucat/.raw /dev/lame/.mp3 &
  /usr/bin/aucat -o - > /dev/aucat/.raw &
  /etc/rc.d/ices start

fi

exit
--------

Unfortunately, this doesn't work exactly as expected either. While aucat 
actually starts up, cron doesn't seem to like something about it and gets stuck 
trying to send a message to root. `ps ax` shows the problem, which just stalls 
there and won't go away:

-PID- ??  I       0:00.04 /usr/sbin/sendmail -FCronDaemon -odi -oem -oi -t

If I kill lame (which brings down aucat and ices), sendmail will then get the 
message through and exit.

Can anyone tell me how to get lame and aucat running properly at startup before 
/etc/rc.d/ices gets called by rc.local?

Can anyone tell me how to get the same working with cron without those sendmail 
problems?

Thanks.

Breeno

Reply via email to