git: 7ffedfe14ca8 - main - service(8): Allow for passing no arguments to the service script
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 09 May 2025 14:59:05 UTC
The branch main has been updated by 0mp: URL: https://cgit.FreeBSD.org/src/commit/?id=7ffedfe14ca85aa3474980092a732d4e49309c62 commit 7ffedfe14ca85aa3474980092a732d4e49309c62 Author: sd@mostnet.ru <sd@mostnet.ru> AuthorDate: 2025-05-09 14:48:27 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2025-05-09 14:56: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 --- 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 1adff6a0de49..a8f1a509885f 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 April 19, 2025 +.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