From owner-freebsd-rc@freebsd.org Thu Aug 1 19:51:34 2019 Return-Path: Delivered-To: freebsd-rc@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 EF8E5C7A87 for ; Thu, 1 Aug 2019 19:51:34 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4601Bt24mHz4CXW for ; Thu, 1 Aug 2019 19:51:34 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1564689092; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=Ms4CIqMtkP6h0tASsO/VonD58pJl2TjPUjSwcK8rZ+POmM8I5WZK8NuD96QLJHDKzIhMaGfo2kiX0 F02ZTD787aTumFzFXTkc1QdTpYHfy8m4YfNCqG3CrXua/ngv0OhKgOhXI6chwfSwcza4U0AdLGgW+x xYDwmZT7+KrjN/HEkYYfKis/ArzlKssZfk1JG28P+ieRcuseY6l4ca2AqZXE8zm8Y5lGEC0+V3NoAQ JX8/3wSCt5wkMtzj1VdQcLdh9qXcmYkEmv3A88uYQFAf9JIDCT6dd85M7j8LFzUy14h5e4ERbSPOzf s5m+2G882pJTfDebR0GZCPju3pNAdDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=85Lgl8FM91YG0R0BgewouW+m+///IS1ZVE9iEQTHeSE=; b=uevI/iw+DsB6Kiu6DNWjlX5YYBS7BfR8W+rRgrBtN5EbybDmcGT6nMZbLAYF+uQIQjP17c6ONx0ys Rw4YJZmnUeokoYuIMJ/Zo43bsMBjc7jGfAQEYgbtWQdKVZzvzcHDy3ExTraSzz5vgd3vcWIgGK4ma7 LVTEN/MEZizLOU189vCeduMCRzM39kxeaLL3gBBTwdZRES79JlKL752YQfhINbiGZeHSudvUEE3y9V wKz4Mo05FXxGJMB5GMrT3mN6J3EFp5AE1CpPPrInl4DyQdJG5dIV1euk3zd+XRNR+IFRShfhN+VPCr cA9CR9Rju5I4I7+JfwvSFG5aF2MXp2g== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=85Lgl8FM91YG0R0BgewouW+m+///IS1ZVE9iEQTHeSE=; b=Th0hFjUeOa6o2/i98iPcp40oyy7Cw4dnuj8hkNTzvyS+fzG6SgdIKon0Kj124AP1bXZg0lJSlOLty 0A4Dzw/DUh3vbjovxIO953hi8rz6mE8IWPZQ0o6Kfr12eJ8npMOJxWRjcSU9yLDGa5rdWN6roVOEd5 HL2cNBAu7F2FXJTIaMIVRAO7OmTKNhIMxP2E8mclpeMI/tPeATo2uNCvcp70mGdvRHprw6UO3bJ2d6 e/68DUlpICGObcA7XXLtq6LxfP5H8li1GmZwQB5GYRhoWykm5QN7pk1RHqVtwvhRApPTDIDphrN9to AaGTG27rmH0wPLGb5kBsj1eR15kc+xQ== X-MHO-RoutePath: aGlwcGll X-MHO-User: c13014c6-b495-11e9-85ec-13b9aae3a1d2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id c13014c6-b495-11e9-85ec-13b9aae3a1d2; Thu, 01 Aug 2019 19:51:31 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x71JpT22002721; Thu, 1 Aug 2019 13:51:29 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: rc script: manual stop vs system shutdown From: Ian Lepore To: Andriy Gapon , Warner Losh , "Rodney W. Grimes" Cc: FreeBSD Current , freebsd-rc@freebsd.org Date: Thu, 01 Aug 2019 13:51:29 -0600 In-Reply-To: References: <2e50fb67-8a19-412b-19d2-14f5f20b61f8@FreeBSD.org> <201908011553.x71FrTCd060252@gndrsh.dnsmgr.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4601Bt24mHz4CXW X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-0.71 / 15.00]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_SHORT(-0.71)[-0.715,0] X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Aug 2019 19:51:35 -0000 On Thu, 2019-08-01 at 21:14 +0300, Andriy Gapon wrote: > On 01/08/2019 19:12, Warner Losh wrote: > > > > > > On Thu, Aug 1, 2019, 10:53 AM Rodney W. Grimes > > > > > wrote: > > > > > > > > Is it possible in an rc script to distinguish between a manual stop > > > (e.g., service foo stop) and a stop during a system shutdown (via > > > rc.shutdown) ? > > > Are there any marker variables for that? > > > Or something in the global system state? > > > > Not that I can think of, but I like this idea, > > I am sure that use cases exist. > > > > > > What is the use case that needs to disambiguate the two cases... > > I have one use case in mind and it's a truly special case. > I want rc.d/watchdogd to gracefully stop watchdogd and to disable the > watchdog timer when the stop action is requested manually. And I want > it to stop watchdogd and set the watchdog timer to a special shutdown > timeout during the shutdown. If the special timeout is configured, of > course. > The shutdown timeout is already supported: you just set '-x ' in watchdogd_flags in rc.conf; no changes to the rc.d script needed. I think probably you don't even need the first part of what you want. The -x arg covers you in the reboot case; most people probably won't use it. But if you are using it, and you want to truly kill the dog, you would just do "watchdog -t 0" after "service watchdogd stop". If you really felt the need to cover that with a single service command, then how about using "service watchdogd cancel" where the cancel verb does the -t 0 after killing the daemon? -- Ian