The branch stable/14 has been updated by 0mp: URL: https://cgit.FreeBSD.org/src/commit/?id=4e0a5fd7b608d823767ad239db68cb961455ba6b
commit 4e0a5fd7b608d823767ad239db68cb961455ba6b Author: s...@mostnet.ru <s...@mostnet.ru> AuthorDate: 2025-05-09 14:48:27 +0000 Commit: Mateusz Piotrowski <0...@freebsd.org> CommitDate: 2025-05-23 08:41:58 +0000 service(8): Allow for passing no arguments to the service script 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 Reviewed by: bnovkov, christos, imp, lme, markj Approved by: bnovkov (mentor), christos (mentor), markj (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D47328 (cherry picked from commit 7ffedfe14ca85aa3474980092a732d4e49309c62) --- usr.sbin/service/service.8 | 4 ++-- usr.sbin/service/service.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/service/service.8 b/usr.sbin/service/service.8 index 380fbc8c1269..7528fa04b0f1 100644 --- a/usr.sbin/service/service.8 +++ b/usr.sbin/service/service.8 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 29, 2024 +.Dd May 9, 2025 .Dt SERVICE 8 .Os .Sh NAME @@ -48,7 +48,7 @@ .Op Fl v .Op Fl E Ar var=value .Ar script -.Ar command +.Op Ar command .Sh DESCRIPTION The .Nm diff --git a/usr.sbin/service/service.sh b/usr.sbin/service/service.sh index 245430107277..8b7aa937967b 100755 --- a/usr.sbin/service/service.sh +++ b/usr.sbin/service/service.sh @@ -162,7 +162,7 @@ if [ -n "$RCORDER" ]; then exit 0 fi -if [ $# -gt 1 ]; then +if [ $# -gt 0 ]; then script=$1 shift else