Page MenuHomeFreeBSD

service(8): Allow for passing no arguments to the service script
ClosedPublic

Authored by 0mp on Oct 29 2024, 1:01 PM.
Tags
Referenced Files
Unknown Object (File)
Thu, Dec 11, 7:27 AM
Unknown Object (File)
Thu, Nov 27, 5:41 AM
Unknown Object (File)
Wed, Nov 26, 7:35 AM
Unknown Object (File)
Nov 12 2025, 5:18 PM
Unknown Object (File)
Nov 9 2025, 10:46 PM
Unknown Object (File)
Nov 6 2025, 10:50 PM
Unknown Object (File)
Nov 3 2025, 8:33 AM
Unknown Object (File)
Nov 1 2025, 1:46 PM

Details

Summary

Currently, service(8) requires the user to provide a command to the
rc service script. For example,

service cron

does not even run the cron rc service script but
instead shows the usage message of service(8).

This patch makes it so running the rc service script with no arguments
via service(8) is closer to running the rc service script directly
(e.g., /etc/rc.d/cron).

Long story short, for most of the rc service scripts this change means
that running "service FOO" now shows the usage message of FOO instead of
the usage message of service(8).

PR: 255115
MFC after: 2 weeks

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

0mp requested review of this revision.Oct 29 2024, 1:01 PM
This revision is now accepted and ready to land.Oct 29 2024, 3:19 PM

Seems sane enough. It's not something we use today, and I've verified that run_rc_command should do the right thing w/o side effects (although I'd think that the -z rc_arg test should be higher in that function to avoid pid file name eval, etc).