Hi Alan,

> I simply want to disable that one particular beeping at shutdown time.

well this topic made me curious where the beep is coming from.

It does originate from the shutdown command itself which is part of the
sys-apps/sysvinit package. In this package's source you find can a file
"src/dowall.c", where you will in turn find a function "wall(...)".

This is the function where the warning messages will be produced that
show up in the terminal and the message is produced like this:

snprintf(line, sizeof(line),
        "\007\r\nBroadcast message from %s@%s %s(%s):\r\n\r\n",
        user, hostname, tty, date);

The "\007" is the beep you're getting. It's a bell character that you
can produce manually by doing this, too:

echo -e "\007"

Unfortunately the bell character is hard coded into the warning message.
Also there seems to be no way to suppress the warning message.

But you could still try is to disable the interpretation of the bell
character by your terminal. Then you could make an alias or wrapper
around the original shutdown command that does this.

According to Arch Linux docs here:

https://wiki.archlinux.org/index.php/Disable_PC_speaker_beep

You can locally disable the bell in the terminal by calling "setterm
-blength 0". But this doesn't work with my terminals. Says it's
unsupported.

Then you can put this in your ~/.inputrc: "set bell-style none". This
works for me. Then, however, all terminals stop beeping. The pcspkr is
still loaded though and can be used.

As you only want to stop the beep only during shutdown you might also be
able to call "xset -b", disabling the bell on the X-server (globally?).
This is not persistent across reboots and you won't have any beeps until
the machine shuts down.

Regards

Matthias

Attachment: signature.asc
Description: Digital signature

Reply via email to