From owner-freebsd-current@freebsd.org Thu Aug 1 18:53:39 2019 Return-Path: Delivered-To: freebsd-current@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 B3032C5C49; Thu, 1 Aug 2019 18:53:39 +0000 (UTC) (envelope-from fjwcash@gmail.com) Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 45zzw33LnWz465w; Thu, 1 Aug 2019 18:53:39 +0000 (UTC) (envelope-from fjwcash@gmail.com) Received: by mail-lj1-x22b.google.com with SMTP id m8so36825770lji.7; Thu, 01 Aug 2019 11:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6PGNlte3FPx+5IChUgoRkrdcPeksN55rtPuZk3l23ws=; b=XhMZNK7OiWwZvwXQEwr+Q297u79zyxo5lOenkYMThPnfeWHyHJ8nbIxTzoD2bOn5Tx Mrd/1icm86YZNHNKUpMLhw25vZcYUyNgzKPXFgcnOi8TNH3qO6uVvNjCoPeAY4DQmrbz W6FMpANzKRpr2V7GNzQY78KUO9PS+QNGeGjIG4gI32B6e+mKTvdsxKPeYrHJSAUvDqvO TwWQRdLHt5WJbhrORMA0YpaPyqUpJTyWKeY0aJT5rW97vADnJFd/SCaZmhK94B0rwMI4 YIglWGYujGf/G+rt6XeXzRIiU3u33Ydnbiy/e5P/wp6WK84DQLcQPLMNuAbD+Xz0Qxbo znVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6PGNlte3FPx+5IChUgoRkrdcPeksN55rtPuZk3l23ws=; b=qBRLL12lyDBXlvpMQ3VVZxDrjiCcbiOLul+8gSs022+clxKVeot3AN21ND8mjB4qWR UoC9oMvSiu29uMgvS5jPVuGAvjDAVEedFKPvw4WpUZfaH6f0Ot+KyUVafrTsRLZmYP+w OSbqz9kt5yad5ConQ73cvGl8VKV/8WS/e1D9cUdY/DB40hUp/pqd0FiVKfOIYJvxn1ZL 0YCWVGLRYGeZhah49iemE4DF2wjkZkcuDctZEs9rZonQ3JsGQI7Uuk1mIHeNfYi3IRN0 47fOR4KDZiNkeOER7GZ5KpIoiDW2sU0Vdw9IQTo4ltAdOsePKvKOXeqFCbwZvsmrsaFS UHUQ== X-Gm-Message-State: APjAAAXHlYUZPdO3ZTzgb3wqptgfAeWIm/urPoZY1LS3zGvj1bfUQpAy FF7PpV3vvM6WNc97MKaesBxW2+WOvzF00by+9aH4Sw== X-Google-Smtp-Source: APXvYqzeciHlswcecxRR7/fihqEOpZH3/C/oSjRxZl5vo+ogC0/OgqCqxvZ8KbSU7+VikC1yvFN+Gg57eLYPcBq6JW8= X-Received: by 2002:a2e:93c8:: with SMTP id p8mr19587491ljh.6.1564685617222; Thu, 01 Aug 2019 11:53:37 -0700 (PDT) MIME-Version: 1.0 References: <2e50fb67-8a19-412b-19d2-14f5f20b61f8@FreeBSD.org> <201908011553.x71FrTCd060252@gndrsh.dnsmgr.net> In-Reply-To: From: Freddie Cash Date: Thu, 1 Aug 2019 11:53:25 -0700 Message-ID: Subject: Re: rc script: manual stop vs system shutdown To: Andriy Gapon Cc: Warner Losh , "Rodney W. Grimes" , FreeBSD-Current , freebsd-rc@freebsd.org X-Rspamd-Queue-Id: 45zzw33LnWz465w X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.98 / 15.00]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.979,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Aug 2019 18:53:39 -0000 On Thu, Aug 1, 2019, 11:15 AM 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. > A horribly hackish workaround could be to do a "pgrep shutdown" and "pgrep reboot" and "pgrep halt" in the stop function of the RC script. If one of those those processes exist, then a system shutdown/reboot is in progress. Not elegant, but could be workable until something nicer is added. Cheers, Freddie Typos courtesy of my phone's keyboard. >