I am trying to write a bash startup script in Ubuntu 9.04 that will remove the annoying system beep from my computer:

#/bin/bash

rmmod pcspkr #remove system beep; also doesnt work without root access

it keeps coming back when I start my computer back on, and I want to run a startup script to remove this annoyance. But I do not know how to run as root in bash scripting, does anyone know how to log on as root in bash scripting?

link|improve this question
feedback

3 Answers

up vote 10 down vote accepted

Add this to the end of /etc/modprobe.d/blacklist:

blacklist pcspkr

This will prevent the pc speaker module from being loaded when you start the computer.

link|improve this answer
Agree, it's better to not load the module than to load and then unload it. – pgs Jul 2 '09 at 2:49
feedback

Put this command into /etc/rc.local.

link|improve this answer
What command? By voting answers go out of order remember? – Luke Jul 2 '09 at 4:33
@Luke: The only command here is one in the original question. – grawity Jul 2 '09 at 11:14
feedback
  1. Try System ==> Preferences ==> Startup Applications; You might be able to put your command right there...
  2. Check this post describing a /etc/init.d path for one more option
  3. You could add it to the root cron job (but that will go better with a module check).

do not have a Ubuntu handy to try this now.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown