Re: Start pacat on boot (or after xbmc) [OT]

2014-02-19 Thread Paul E Condon
On 20140219_115052, Redalert Commander wrote:
> Hi again,
> 
> The bad news is that no one answered my e-mail, the good news is that
> I managed to solve this myself.
> More below.
> 
> 2014-02-17 23:53 GMT+01:00 Steven Post :
> > I have a script that starts and kills pacat (pulseaudio cat) in order to
> > get my USB turntable to work.
> > It is a rather simple script, reproduced below for reference.
> > I want to run this script at boot, but whatever I try, it doesn't seem
> > to work. When started at boot (using an init script, or rc.local) the
> > log it produces is always "pa_stream_drain(): Bad state".
> > When running the script manually it works perfectly.
> > The script is invoked with this command:
> > su username -l -c /path/to/vinyl.sh
> >
> This is now fixed by adding the following cron job (crontab -e)
> @reboot sleep 10; /path/to/vinyl.sh
> 
> I think the issue was that pacat was started too soon (before
> pulseaudio), and thus the sleep makes sure that the system is fully
> operational.
> If you do this yourself, you may find that 10 seconds is not enough,
> since this was a pretty minimal system with a SSD.
> 
> A better approach would be to check 'ps' for the pulseaudio existence
> in a loop with a sleep 1,
> thus minimizing the time between full boot and starting pacat, while
> still being sure it doesn't launch to soon (even on slow systems).
> I'll have a go at that tomorrow.
> 
> Best regards,
> Steven

This problem might be a good use-case for the benefits of systemd ;-)
But caution, I don't really understand systemd very well yet.

-- 
Paul E Condon   
pecon...@mesanetworks.net


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20140219202718.gb19...@big.lan.gnu



Re: Start pacat on boot (or after xbmc)

2014-02-19 Thread Redalert Commander
Hi again,

The bad news is that no one answered my e-mail, the good news is that
I managed to solve this myself.
More below.

2014-02-17 23:53 GMT+01:00 Steven Post :
> I have a script that starts and kills pacat (pulseaudio cat) in order to
> get my USB turntable to work.
> It is a rather simple script, reproduced below for reference.
> I want to run this script at boot, but whatever I try, it doesn't seem
> to work. When started at boot (using an init script, or rc.local) the
> log it produces is always "pa_stream_drain(): Bad state".
> When running the script manually it works perfectly.
> The script is invoked with this command:
> su username -l -c /path/to/vinyl.sh
>
This is now fixed by adding the following cron job (crontab -e)
@reboot sleep 10; /path/to/vinyl.sh

I think the issue was that pacat was started too soon (before
pulseaudio), and thus the sleep makes sure that the system is fully
operational.
If you do this yourself, you may find that 10 seconds is not enough,
since this was a pretty minimal system with a SSD.

A better approach would be to check 'ps' for the pulseaudio existence
in a loop with a sleep 1,
thus minimizing the time between full boot and starting pacat, while
still being sure it doesn't launch to soon (even on slow systems).
I'll have a go at that tomorrow.

Best regards,
Steven


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAMDu+mO5=NOQyEDaD_feqOgHp8MaYeoKYKKC=qzc-ckm8v9...@mail.gmail.com



Start pacat on boot (or after xbmc)

2014-02-17 Thread Steven Post

Hi,

I have a script that starts and kills pacat (pulseaudio cat) in order to
get my USB turntable to work.
It is a rather simple script, reproduced below for reference.
I want to run this script at boot, but whatever I try, it doesn't seem
to work. When started at boot (using an init script, or rc.local) the
log it produces is always "pa_stream_drain(): Bad state".
When running the script manually it works perfectly.
The script is invoked with this command:
su username -l -c /path/to/vinyl.sh

#!/bin/bash
SERVICE='pacat'
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
killall pacat
else
pacat -r -d 
alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00-CODEC.analog-stereo | 
pacat -p -d alsa_output.default > ~/templog 2>&1
fi

Any ideas would be welcome.

Best regards,
Steven




signature.asc
Description: This is a digitally signed message part