Alsa Boot Script

Due to a bug in Debian Sid I'm currently having to run "alsactl init" at the command-line to start my sound card. This wasn't a big issue, but I though automating this simple task at boot would be more efficient. I made the following script in /etc/init.d/ and ran chmod +x on it:

root@me:/etc/init.d# cat atboot.sh 
#!/bin/bash

alsactl init
echo "All your base belong to us..."

We my system boots up I see the test string being echoed "All your base belong to us...". However, the sound does not start and I have to run "alsactl init" again from the command-line to start sound. Does anyone know anything I may be missing?

It may depend on other modules. Try running it towards the end of the boot process. And, include some error checking + output.

Ok, I know how to send stderr to a file with this but how would one make a script execute toward the end of the boot process? Not sure how to specify that.

You mentioned you're on Debian? Check /etc/init.d/README and the references therein.

Hi Azrael...

I have been doing a bit of lateral thinking here and came up with an idea...

You say that you enable alsa at the command line so I assume a terminal rather than
a console.

Maybe your script to enable alsa requires a small delay inside a terminal to do its job.
(I once had a similar problem with Caldera 7 and had to use a batch file from a Windows
boot to enable the sound card before LinLoad.)

Why not try this idea out, assuming you have xterm:-

#!/bin/bash --posix
> /tmp/alsaboot.sh
chmod 755 /tmp/alsaboot.sh
echo "#!/bin/bash" >> /tmp/alsaboot.sh
echo "echo alsactl init" >> /tmp/alsaboot.sh
echo "echo 'All your base belong to us...'" >> /tmp/alsaboot.sh
echo "sleep 5" >> /tmp/alsaboot.sh
xterm -e /tmp/alsaboot.sh &

You WILL have to edit this script at line 5 to remove the second echo to use but just check
that this idea works first before removing it.

It does work on the OSX 10.7.5, default bash terminal...

Just an idea that reminded me of my traumas with Caldera 7.

Whoa... Sorry about the late reply. You're example did work for me after some tweaking. Thank you Wisecracker! Much appreciated!