public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: cygwin@cygwin.com
Subject: Re: services startup postinstall scripts
Date: Wed, 26 Jan 2022 13:23:24 -0700	[thread overview]
Message-ID: <b3264a97-b67c-b1dd-c9b3-ad6cdf674862@SystematicSw.ab.ca> (raw)
In-Reply-To: <118552712.20220126175029@yandex.ru>

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:

for srv in	ssh ssh-agent sshbroker sshproxy	\
		sshd sshdbroker sshdproxy		\
		vmictimesysnc w32time # for GPS ref Windows NTP server
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

with suitable checks, messages, and logging added.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

  reply	other threads:[~2022-01-26 20:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20 16:15 Updated cygwin this morning, mintty window flashes briefly and quits Keith Christian
2022-01-20 16:41 ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-01-20 18:33   ` Keith Christian
2022-01-20 20:24     ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-01-20 23:02       ` Keith Christian
2022-01-21  7:45       ` Brian Inglis
2022-01-26 14:50         ` Andrey Repin
2022-01-26 20:23           ` Brian Inglis [this message]
2022-01-28  8:18             ` services startup postinstall scripts Andrey Repin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b3264a97-b67c-b1dd-c9b3-ad6cdf674862@SystematicSw.ab.ca \
    --to=brian.inglis@systematicsw.ab.ca \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).