Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 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.

share|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
add comment
  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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.