From owner-svn-ports-all@freebsd.org Wed Aug 28 16:02:01 2019 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEC78E0305; Wed, 28 Aug 2019 16:02:01 +0000 (UTC) (envelope-from jgh@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JVqY4gPdz4Mw7; Wed, 28 Aug 2019 16:02:01 +0000 (UTC) (envelope-from jgh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 698BE9AFF; Wed, 28 Aug 2019 16:02:01 +0000 (UTC) (envelope-from jgh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7SG21PV010702; Wed, 28 Aug 2019 16:02:01 GMT (envelope-from jgh@FreeBSD.org) Received: (from jgh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SG20nJ010700; Wed, 28 Aug 2019 16:02:00 GMT (envelope-from jgh@FreeBSD.org) Message-Id: <201908281602.x7SG20nJ010700@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jgh set sender to jgh@FreeBSD.org using -f From: Jason Helfman Date: Wed, 28 Aug 2019 16:02:00 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r510076 - in head/net/htpdate: . files X-SVN-Group: ports-head X-SVN-Commit-Author: jgh X-SVN-Commit-Paths: in head/net/htpdate: . files X-SVN-Commit-Revision: 510076 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Aug 2019 16:02:01 -0000 Author: jgh Date: Wed Aug 28 16:02:00 2019 New Revision: 510076 URL: https://svnweb.freebsd.org/changeset/ports/510076 Log: - fix service script For some reason the PID written to the pidfile by htpdate does not match its actual PID, which renders the standard PID-handling mechanism of rc.subr(8) useless. As a solution, depend only on the process name to figure out the PID of the running process. NB: the old pidfile has to be removed before starting htpdate. Otherwise, the program complains about the pidfile already existing (which htpdate interprets as another instance of htpdate already running). Also: - Use %%PREFIX%% to let the ports provide a proper path for the binary. - Do not specify htpdate_flags in command_args. htpdate_flags are already passed to the program by rc.subr(8). In response to this mailing list thread: https://lists.freebsd.org/pipermail/freebsd-rc/2019-August/004047.html Submitted by: 0mp@ Differential Revision: https://reviews.freebsd.org/D21431 Modified: head/net/htpdate/Makefile head/net/htpdate/files/htpdate.in Modified: head/net/htpdate/Makefile ============================================================================== --- head/net/htpdate/Makefile Wed Aug 28 15:59:59 2019 (r510075) +++ head/net/htpdate/Makefile Wed Aug 28 16:02:00 2019 (r510076) @@ -3,6 +3,7 @@ PORTNAME= htpdate PORTVERSION= 1.2.2 +PORTREVISION= 1 CATEGORIES= net ipv6 MASTER_SITES= http://www.vervest.org/htp/archive/c/ \ http://twekkel.home.xs4all.nl/htp/ Modified: head/net/htpdate/files/htpdate.in ============================================================================== --- head/net/htpdate/files/htpdate.in Wed Aug 28 15:59:59 2019 (r510075) +++ head/net/htpdate/files/htpdate.in Wed Aug 28 16:02:00 2019 (r510076) @@ -3,8 +3,7 @@ # $FreeBSD$ # PROVIDE: htpdate -# REQUIRE: NETWORKING SERVERS -# BEFORE: DAEMON +# REQUIRE: NETWORKING syslogd # KEYWORD: shutdown # Add the following line to /etc/rc.conf to enable htpdate: @@ -14,31 +13,27 @@ . /etc/rc.subr -load_rc_config htpdate - -htpdate_enable="${htpdate_enable:-"NO"}" -htpdate_servers="${htpdate_servers:-"www.example.com"}" -htpdate_flags="${htpdate_flags:-"-l -s -D"}" - name=htpdate +desc="HTTP Time Protocol daemon" rcvar=htpdate_enable -servers=${htpdate_servers} -pidfile=/var/run/htpdate.pid -command="/usr/local/bin/htpdate" -command_args="${htpdate_flags} $servers" -stop_cmd=htpdate_stop +load_rc_config htpdate -htpdate_stop () +: ${htpdate_enable:="NO"} +: ${htpdate_servers:="www.example.com"} +: ${htpdate_flags:="-l -s -D"} + +start_precmd=htpdate_prestart +command="%%PREFIX%%/bin/htpdate" +command_args="${htpdate_servers}" + +htpdate_prestart() { - if [ -f ${pidfile} ]; then - echo "Stopping htpdate." - kill `cat ${pidfile}` - else - echo "htpdate is not running." - fi + local _pidfile="/var/run/htpdate.pid" - rm -f ${pidfile} + if [ -z "$(check_process "${command}")" ]; then + rm -f -- "${_pidfile}" + fi } run_rc_command "$1"