Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Aug 2021 16:46:12 GMT
From:      Maxim Sobolev <sobomax@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 2651609fcbd7 - main - Allow rc.d script to provide "status" method, even if it does not define procname or have a PID file. This might be useful for cases, such as mounting local FS, when there is no running daemon still some other persistent state in the system which status can be checked.
Message-ID:  <202108201646.17KGkCeW088230@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by sobomax:

URL: https://cgit.FreeBSD.org/src/commit/?id=2651609fcbd70725cb94902145032dbb7c1e89c4

commit 2651609fcbd70725cb94902145032dbb7c1e89c4
Author:     Maxim Sobolev <sobomax@FreeBSD.org>
AuthorDate: 2021-08-20 16:43:04 +0000
Commit:     Maxim Sobolev <sobomax@FreeBSD.org>
CommitDate: 2021-08-20 16:43:46 +0000

    Allow rc.d script to provide "status" method, even if it does not
    define procname or have a PID file. This might be useful for cases,
    such as mounting local FS, when there is no running daemon
    still some other persistent state in the system which status
    can be checked.
    
    It is still possible to have a status method before this by having
    extra_commands="status", but it's not obvious and might give
    an script writer some extra legwork to figure out how and why
    the straight method is not working.
    
    Reviewed by:    cy
    MFC after:      1 week
    Relnotes:       yes
    Differential Revision:  https://reviews.freebsd.org/D31614
---
 libexec/rc/rc.subr | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr
index b027fa5facf4..7144c3cbfce9 100644
--- a/libexec/rc/rc.subr
+++ b/libexec/rc/rc.subr
@@ -958,6 +958,11 @@ run_rc_command()
 			_pidcmd='rc_pid=$(check_process '"$_procname $command_interpreter"')'
 		fi
 		_keywords="${_keywords} status poll"
+	else
+		if [ ! -z "${status_cmd}" ]
+		then
+			_keywords="${_keywords} status"
+		fi
 	fi
 
 	if [ -z "$rc_arg" ]; then



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108201646.17KGkCeW088230>