From owner-freebsd-current@freebsd.org Thu Aug 1 18:09:26 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 ABC20C45E3; Thu, 1 Aug 2019 18:09:26 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) (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 45zyx14fdsz42PY; Thu, 1 Aug 2019 18:09:25 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-pl1-f196.google.com with SMTP id m9so32436300pls.8; Thu, 01 Aug 2019 11:09:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=0elvBftZxBTl1Qi7kM/W4D6PN8QQaPYCosRxtv0hQn4=; b=YV/71C3coe3xXWfErd0KiPsV3CChIEsGw6TrmB1i5RWeJSqVS1IYZD6+Kd38vRMjXc dqxyzcPF6iS8S/Ecv/bYA9M+Gb8Xig/mLoOlnhCyGHCnJA0otehw2YA2BLIavSCuumpE HLD8a4rW5H1IwFePwFquY3C5dGN+MuBi7KXHRsQxqwatFCHuZSUjIB+/JjeKejmOml1h SggsomUWwSYV82LK0MoF4z3LA1eWLBzR9pFzgdUTP4QNfW986q5L1jPLV8GIfqeuESY9 KR1ZznPCSJ4sS/luNJu/kEBFN9tUArzPAUkf2O5rHE1PmccQPlbIxvNJ+l2ustm3acll 2Hag== X-Gm-Message-State: APjAAAV4xm9J/3id53tyfZchvgL8msRbhX5RHInYcryb6fVoZpAqSCYx INg5LJEKEj2vwZMPiEZgkhthoHXG X-Google-Smtp-Source: APXvYqx4RBig+NCwarQdMq7dGgpjrrGbKmTQ/2blNx19yyWKFig3TdXQqD+GMk3o8bq7xChrLt+sEA== X-Received: by 2002:a17:902:6b02:: with SMTP id o2mr72554199plk.99.1564682963909; Thu, 01 Aug 2019 11:09:23 -0700 (PDT) Received: from [192.168.1.36] (broadband-82-140-233-136.atc.tvcom.ru. [82.140.233.136]) by smtp.googlemail.com with ESMTPSA id q24sm5401102pjp.14.2019.08.01.11.09.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Aug 2019 11:09:23 -0700 (PDT) Subject: Re: rc script: manual stop vs system shutdown To: "Rodney W. Grimes" , Enji Cooper Cc: freebsd-rc@freebsd.org, FreeBSD Current References: <201908011739.x71Hdrfh060807@gndrsh.dnsmgr.net> From: Andriy Gapon Openpgp: preference=signencrypt Message-ID: Date: Thu, 1 Aug 2019 21:09:18 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <201908011739.x71Hdrfh060807@gndrsh.dnsmgr.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 45zyx14fdsz42PY X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.214.196 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-2.10 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[FreeBSD.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.92)[-0.918,0]; RCVD_IN_DNSWL_NONE(0.00)[196.214.85.209.list.dnswl.org : 127.0.5.0]; RWL_MAILSPIKE_GOOD(0.00)[196.214.85.209.rep.mailspike.net : 127.0.0.18]; IP_SCORE(-1.18)[ipnet: 209.85.128.0/17(-3.41), asn: 15169(-2.46), country: US(-0.05)]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[136.233.140.82.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; MID_RHS_MATCH_FROM(0.00)[] 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:09:26 -0000 On 01/08/2019 20:39, Rodney W. Grimes wrote: >> On Aug 1, 2019, at 08:53, 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. >> >> Have you looked at: >> keyword: shutdown >> etc? > > Well that does indeed seem to wipe out my > "Not that I can think of". So infact an rc script > can tell, it is invoked as: > > /etc/rc.d/foo shutdown > during a system shutdown > > vs > > /etc/rc.d/foo stop > when invoked by service foo stop? > > Is that correct? > Except there is no 'foo shutdown'. It's foo stop in both cases. To be pedantic, it's foo faststop for shutdown, but that can be manually invoked as well. -- Andriy Gapon