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.ca>wrote:
>
> > 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

Reply via email to