Re: Conundrum with aucat and rc_scripts
On Thu, Sep 8, 2011 at 10:01 PM, Breen Ouellette misc.open...@usask.cawrote: 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: snip 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 Hi Breeno, my suggestion is to use ezstream http://www.icecast.org/ezstream.php from the same icecast group instead. It will take a stream so you can use: aucat -o - | lame -r - - | ezstream -c ezstream.xml If you throw it into rc.local you will have to disconnect it from the terminal for it to work. /etc/rc.local: /usr/bin/aucat -o - 2 /dev/null | /usr/local/bin/lame -r - - | /usr/local/bin/ezstream -q -c /etc/ezstream.xml /dev/null /dev/null or I've dumped it into a script aucat | lame | ezstream echo $! stream.pid to use pid checking instead of that ps grepping (killing the ezstream will terminate the entire command set) and then you can also use an rc.d script daemon=script daemon_user=_no_priv daemon_flags=/dev/null /dev/null Funny story, I'm working on something similar and will shortly have a question for misc too - watch for it as aucat is giving me some trouble. G0kita
Re: Conundrum with aucat and rc_scripts
G0kita, So, to more generally confirm the solution to the problems with my scripts: Commands located in the rc infrastructure, or in scripts called by cron, must redirect terminal output to /dev/null or they might not work as expected. Is the above a true statement? Thanks! Breeno Quoting G 0kita goo...@gmail.com: On Thu, Sep 8, 2011 at 10:01 PM, Breen Ouellette misc.open...@usask.cawrote: 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: snip 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 Hi Breeno, my suggestion is to use ezstream http://www.icecast.org/ezstream.php from the same icecast group instead. It will take a stream so you can use: aucat -o - | lame -r - - | ezstream -c ezstream.xml If you throw it into rc.local you will have to disconnect it from the terminal for it to work. /etc/rc.local: /usr/bin/aucat -o - 2 /dev/null | /usr/local/bin/lame -r - - | /usr/local/bin/ezstream -q -c /etc/ezstream.xml /dev/null /dev/null or I've dumped it into a script aucat | lame | ezstream echo $! stream.pid to use pid checking instead of that ps grepping (killing the ezstream will terminate the entire command set) and then you can also use an rc.d script daemon=script daemon_user=_no_priv daemon_flags=/dev/null /dev/null Funny story, I'm working on something similar and will shortly have a question for misc too - watch for it as aucat is giving me some trouble. G0kita
Pipes, redirects, and rc.local (was: Conundrum with aucat and rc_scripts)
G0kita, I've had a chance to review your advice, and I believe I've spotted a problem with your redirects. The command that works for me is: /usr/bin/aucat -o - 2/dev/null /dev/null | /usr/local/bin/lame -r -a -b 56 - - 2/dev/null | /usr/local/bin/ezstream -c /etc/ezstream.xml /dev/null 21 Before the first pipe: aucat is sending audio to stdout, so we don't want to mess with that. However, we want to disconnect terminal output (only stderr remains) and terminal input so we redirect accordingly to /dev/null. Before the second pipe: lame is receiving data from stdin and sending data to stdout, so we don't want to mess with that. However, we want to disconnect terminal output (only stderr remains) so we redirect accordingly to /dev/null. After the second pipe: ezstream is receiving data from stdin, so we don't want to mess with that. However, we want to disconnect terminal output (both stdout and stderr in this final case) so we redirect accordingly to /dev/null. The above works for me when added to rc.local, and works when added to my watchdog script that is executed by cron. Breeno Quoting G 0kita goo...@gmail.com: If you throw it into rc.local you will have to disconnect it from the terminal for it to work. /etc/rc.local: /usr/bin/aucat -o - 2 /dev/null | /usr/local/bin/lame -r - - | /usr/local/bin/ezstream -q -c /etc/ezstream.xml /dev/null /dev/null --snip--
Re: Pipes, redirects, and rc.local (was: Conundrum with aucat and rc_scripts)
Correction: This works fine from a script executed by cron. Still doesn't work from rc.local. Anyone willing to impart some additional wisdom? Breeno Quoting misc.open...@mail.usask.ca: G0kita, I've had a chance to review your advice, and I believe I've spotted a problem with your redirects. The command that works for me is: /usr/bin/aucat -o - 2/dev/null /dev/null | /usr/local/bin/lame -r -a -b 56 - - 2/dev/null | /usr/local/bin/ezstream -c /etc/ezstream.xml /dev/null 21 Before the first pipe: aucat is sending audio to stdout, so we don't want to mess with that. However, we want to disconnect terminal output (only stderr remains) and terminal input so we redirect accordingly to /dev/null. Before the second pipe: lame is receiving data from stdin and sending data to stdout, so we don't want to mess with that. However, we want to disconnect terminal output (only stderr remains) so we redirect accordingly to /dev/null. After the second pipe: ezstream is receiving data from stdin, so we don't want to mess with that. However, we want to disconnect terminal output (both stdout and stderr in this final case) so we redirect accordingly to /dev/null. The above works for me when added to rc.local, and works when added to my watchdog script that is executed by cron. Breeno Quoting G 0kita goo...@gmail.com: If you throw it into rc.local you will have to disconnect it from the terminal for it to work. /etc/rc.local: /usr/bin/aucat -o - 2 /dev/null | /usr/local/bin/lame -r - - | /usr/local/bin/ezstream -q -c /etc/ezstream.xml /dev/null /dev/null --snip--
Conundrum with aucat and rc_scripts
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 21 kill $AUCAT_PID /dev/null 21 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