From nobody Thu Mar 02 20:32:34 2023 X-Original-To: rc@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PSN8D0q4Lz3wF8J for ; Thu, 2 Mar 2023 20:32:44 +0000 (UTC) (envelope-from SRS0=ktWf=62=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [94.124.105.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4PSN8B6kmVz3tQT for ; Thu, 2 Mar 2023 20:32:42 +0000 (UTC) (envelope-from SRS0=ktWf=62=quip.cz=000.fbsd@elsa.codelab.cz) Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of "SRS0=ktWf=62=quip.cz=000.fbsd@elsa.codelab.cz" has no SPF policy when checking 94.124.105.4) smtp.mailfrom="SRS0=ktWf=62=quip.cz=000.fbsd@elsa.codelab.cz"; dmarc=none Received: from elsa.codelab.cz (localhost [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id 01030D789F for ; Thu, 2 Mar 2023 21:32:39 +0100 (CET) Received: from [192.168.145.50] (ip-89-177-27-225.bb.vodafone.cz [89.177.27.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id 0F8F3D7893 for ; Thu, 2 Mar 2023 21:32:35 +0100 (CET) Message-ID: Date: Thu, 2 Mar 2023 21:32:34 +0100 List-Id: Discussion related to /etc/rc.d design and implementation List-Archive: https://lists.freebsd.org/archives/freebsd-rc List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-rc@freebsd.org X-BeenThere: freebsd-rc@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 To: rc@FreeBSD.org Content-Language: cs-Cestina, en-US From: Miroslav Lachman <000.fbsd@quip.cz> Subject: detailed manual for rc scripting Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-1.75 / 15.00]; AUTH_NA(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.95)[-0.951]; FORGED_SENDER(0.30)[000.fbsd@quip.cz,SRS0=ktWf=62=quip.cz=000.fbsd@elsa.codelab.cz]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[rc@FreeBSD.org]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; R_SPF_NA(0.00)[no SPF record]; ASN(0.00)[asn:42000, ipnet:94.124.104.0/21, country:CZ]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[quip.cz]; RCVD_COUNT_THREE(0.00)[3]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_NEQ_ENVFROM(0.00)[000.fbsd@quip.cz,SRS0=ktWf=62=quip.cz=000.fbsd@elsa.codelab.cz]; FROM_HAS_DN(0.00)[]; TO_DN_NONE(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[rc@freebsd.org]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Queue-Id: 4PSN8B6kmVz3tQT X-Spamd-Bar: - X-ThisMailContainsUnwantedMimeParts: N I would like to know if there is something more than https://docs.freebsd.org/en/articles/rc-scripting/ and man rc.subr(8)? Every now and then I need to write some rc script for customer services or fix some existing rc script which became broken after update of base or some packages. Starting the interpreted (node.js, python etc.) services are often way more complicated than what is described in handbook but I always spend about 30% of time by doing the start part and 70% of doing the part required to stop the service - matching command / interpreter / procname is not an easy task and debugging it is even more complicated. Almost always one need to tune just these 3 variables command, command_interpreter, procname but it is sometimes too difficult if one do not have deep knowledge of how things works in rc.subr and sometimes even reading the source of rc.subr is not clear to me. So is there some detailed manual how to put things together in edge cases where service is interpreted, running from Pyhton virtualenv, there are symlinks in path so the real path shown by "ps" is different than the path used to start the service and so on. Kind regards Miroslav Lachman