X-Recipient: archive-cygwin AT delorie DOT com X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EC944385DC35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yandex.ru DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1643358001; bh=z4aCFVHixExWlLN7x15rMDtCfmb0wEl8X4mSPxj3D84=; h=In-Reply-To:Subject:From:Message-ID:References:Date:Reply-To:To; b=W59KWlyM1uWQyaMaPTo0B1eRnuk8685GkCgvrfSdmcF80L5BFrVhfAIuBaF83Hpjv rNNT0F3T7ZLGp+8C4wc+YDxHaodNejIU4AX5/M/yzQBh6tmi6z4VCro7QHpMnzd9Dy RlGHFeRTqzVzc6BfcR7p5kTGQz7QKTYLkGYW01Qg= Authentication-Results: iva8-3dc9d2458f1d.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru X-Yandex-Fwd: 2 Date: Fri, 28 Jan 2022 11:18:55 +0300 From: Andrey Repin X-Mailer: The Bat! (v6.8.8) Home X-Priority: 3 (Normal) Message-ID: <1536908267.20220128111855@yandex.ru> To: Brian Inglis , cygwin AT cygwin DOT com Subject: Re: services startup postinstall scripts In-Reply-To: References: <59cdd990-5b36-7cc8-8d97-4f3c1f042535 AT SystematicSw DOT ab DOT ca> <118552712 DOT 20220126175029 AT yandex DOT ru> MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_THEBAT, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: cygwin AT cygwin DOT com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Greetings, Brian Inglis! > On 2022-01-26 07:50, Andrey Repin wrote: >> Greetings, Brian Inglis! >> >>> restart them in a late local permanent postinstall script >>> /etc/postinstall/zp_z0_l_start_services.dash after setup. >> >> It never occured to me that I can use postinstall tasks to restart services :D >> >> Just add a line >> >> for svc in cygserver $( cygrunsrv --list | grep -v cygserver ); do net start "$svc"; done >> >> and you're golden! > To avoid conflicts you may first want to stop some Windows services > using first sc, then net as backup: net waits for command to be completed, so it's reasonable sure to assume if it completed without an error, things are going smooth. sc is good to make sure service exists. > for srv in ssh ssh-agent sshbroker sshproxy \ > sshd sshdbroker sshdproxy \ > vmictimesysnc w32time # for GPS ref Windows NTP server Why would I need to stop w32time, for example? > do > sc stop $srv > sleep 1 > net stop $srv > done > then start all Cygwin services using cygrunsrv, then sc, then net to be > more sure: > for srv in $(cygrunsrv -L) > do > cygrunsrv -S $srv > sleep 1 > sc start $srv > sleep 1 > net start $srv > done That's overcomplicated, IMO. > with suitable checks, messages, and logging added. And checks to check that checks are checking out? ;) -- With best regards, Andrey Repin Friday, January 28, 2022 11:13:24 Sorry for my terrible english... -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple