From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id E85EA1384BC for ; Tue, 15 Jan 2013 18:21:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AC677E0534; Tue, 15 Jan 2013 18:21:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4ACEAE0534 for ; Tue, 15 Jan 2013 18:21:52 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5C59C33DA43 for ; Tue, 15 Jan 2013 18:21:51 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id E0D84E4073 for ; Tue, 15 Jan 2013 18:21:49 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1358273645.6b3a4110cc0ff21631ad601d994f4c72fb5219c2.WilliamH@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: sh/ X-VCS-Repository: proj/openrc X-VCS-Files: sh/runscript.sh.in X-VCS-Directories: sh/ X-VCS-Committer: WilliamH X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 6b3a4110cc0ff21631ad601d994f4c72fb5219c2 X-VCS-Branch: master Date: Tue, 15 Jan 2013 18:21:49 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 074397cd-fbfc-4c8d-94e9-ff0193758aab X-Archives-Hash: ad5ad1436a34b806363dd1a284eee3a0 commit: 6b3a4110cc0ff21631ad601d994f4c72fb5219c2 Author: William Hubbs gmail com> AuthorDate: Tue Jan 15 18:14:05 2013 +0000 Commit: William Hubbs gentoo org> CommitDate: Tue Jan 15 18:14:05 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=6b3a4110 runscript: fix stopping changed service issues If an init script or service was upgraded while it was running and the settings for the pid file, command and process name were changed, it would not be possible to stop the old service. Runscript now saves the values it used to start the service and re-uses them to stop the service. Reported-by: flameeyes gentoo.org X-Gentoo-Bug: 434032 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=434032 --- sh/runscript.sh.in | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in index 21ff39a..237186a 100644 --- a/sh/runscript.sh.in +++ b/sh/runscript.sh.in @@ -145,7 +145,12 @@ start() ${pidfile:+--pidfile} $pidfile \ $_background $start_stop_daemon_args \ -- $command_args - eend $? "Failed to start $RC_SVCNAME" && return 0 + if eend $? "Failed to start $RC_SVCNAME"; then + service_set_value "command" "${command}" + [ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}" + [ -n "${procname}" ] && service_set_value "procname" "${procname}" + return 0 + fi if yesno "$start_inactive"; then if ! $_inactive; then mark_service_stopped @@ -156,6 +161,12 @@ start() stop() { + local startcommand="$(rc_service_get "command")" + local startpidfile="$(rc_service_get "pidfile")" + local startprocname="$(rc_service_get "procname")" + command="${startcommand:-$command}" + pidfile="${startpidfile:-$pidfile}" + procname="${startprocname:-$procname}" [ -n "$command" -o -n "$procname" -o -n "$pidfile" ] || return 0 ebegin "Stopping ${name:-$RC_SVCNAME}" start-stop-daemon --stop \