Hello, Matthias.

On Tue, Oct 20, 2015 at 07:22:48PM +0200, Matthias Gerstner wrote:
> 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.

Hey, that's brilliant!  Thank you very much indeed!  That is an answer
much more complete than I could have expected.

Probably the most satisfactory way for me to make it work the way I want
is to build my own version of shutdown, removing the offending \007 from
that sprintf format string..... and then to watch out for new versions
of sys-apps/sysvinit.  The package appears to be relatively stable.

> Regards

> Matthias

-- 
Alan Mackenzie (Nuremberg, Germany).

Reply via email to