Page MenuHomeFreeBSD

shutdown: add a flag to suppress warning messages
ClosedPublic

Authored by kevans on Aug 2 2024, 8:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 17, 10:26 PM
Unknown Object (File)
Dec 5 2024, 10:59 PM
Unknown Object (File)
Dec 5 2024, 10:28 PM
Unknown Object (File)
Dec 4 2024, 11:47 AM
Unknown Object (File)
Dec 1 2024, 3:18 PM
Unknown Object (File)
Nov 28 2024, 6:46 AM
Unknown Object (File)
Nov 28 2024, 6:30 AM
Unknown Object (File)
Nov 24 2024, 3:29 AM
Subscribers

Details

Summary

The system-wide warning makes sense in multi-user environments, but
shutdown(8) may be used on systems or in scenarios where there's nobody
to warn and wall(1) just introduces unnecessary complexity and overhead
to the shutdown process.

Add an option to suppress the warning entirely for those contexts that
want to do so, which are anticipated to mainly be in appliance or
single-user desktop-style systems.

Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 58925
Build 55812: arc lint + arc unit

Event Timeline

kevans requested review of this revision.Aug 2 2024, 8:29 PM
kevans created this revision.
imp added inline comments.
sbin/shutdown/shutdown.8
28

Love that time machine... or pessimism on review times :)

This revision is now accepted and ready to land.Aug 2 2024, 8:34 PM
des added inline comments.
sbin/shutdown/shutdown.8
46

I would prefer -q for “quiet”. Systemd's shutdown command has --no-wall for the same purpose with no short name. Upstart's shutdown command does not have an equivalent option; neither do Solaris or AIX.

sbin/shutdown/shutdown.c
596

-W should be in brackets.

des requested changes to this revision.Aug 3 2024, 6:59 AM
This revision now requires changes to proceed.Aug 3 2024, 6:59 AM
kevans marked 2 inline comments as done.

Fix the date (whoops :-)), -W -> -q and fix bracketing in usage

sbin/shutdown/shutdown.8
46

Sure, that works. We can add a --no-wall alias if we grow any other long opts.

Just an idea: perhaps this could be a sysctl. This way, you could set the setting once and interested programs could check the sysctl value before deciding on being verbose or quiet.

In D46216#1054082, @0mp wrote:

Just an idea: perhaps this could be a sysctl. This way, you could set the setting once and interested programs could check the sysctl value before deciding on being verbose or quiet.

I think that's an overly large hammer, but also that it'd need to be at least two knobs- the precise way in which shutdown(8) is verbose is a different monster than, say, how makefs(8) is verbose. The former is broadcasting messages to ttys of other login sessions, while the latter and most other progarms are just emitting more to stderr/stdout. It also wouldn't preclude the need for flags like these anyways, because you're inevitably going to want to be able to selectively override it in individual programs anyways to avoid causing system-wide verbosity or quiet when you're only interested in, e.g, debugging a single program.

In D46216#1054082, @0mp wrote:

Just an idea: perhaps this could be a sysctl. This way, you could set the setting once and interested programs could check the sysctl value before deciding on being verbose or quiet.

I think that's an overly large hammer, but also that it'd need to be at least two knobs- the precise way in which shutdown(8) is verbose is a different monster than, say, how makefs(8) is verbose. The former is broadcasting messages to ttys of other login sessions, while the latter and most other progarms are just emitting more to stderr/stdout. It also wouldn't preclude the need for flags like these anyways, because you're inevitably going to want to be able to selectively override it in individual programs anyways to avoid causing system-wide verbosity or quiet when you're only interested in, e.g, debugging a single program.

Agreed.

This revision is now accepted and ready to land.Aug 6 2024, 4:30 PM