9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] CPURC and starting SSH
Date: Sun, 28 Apr 2013 09:37:06 -0400	[thread overview]
Message-ID: <66c1a6c0c3b28769951c2f9c2398451f@brasstown.quanstro.net> (raw)
In-Reply-To: <b0b668139a669dfb3bbe1dd82ca28193@proxima.alt.za>

On Sun Apr 28 07:58:26 EDT 2013, lucio@proxima.alt.za wrote:
> Unless my copy of /rc/bin/cpurc is out of date, it contains a
> self-confessed "dicey check" to ensure that TCP services are not
> started twice.  In the list of possible candidates to be checked is
> "22" (ssh, of course) which, at least in my case, is started in
> /cfg/$sysname/cpurc as it may not be appropriate on all CPU servers.
>
> I believe that "22" ought to be dropped from that list, in my
> situation it caused the services not to be started, I assume my
> situation is not unique.
>
> A few additional points from my experience:
>
> .	I'm not convinced that the "dicey check" is even necessary: what
> 	is the worst-case scenario?  That a slew of error messages may
> 	arise from a second invocation of aux/listen?  I suspect even that
> 	isn't likely.  If it is, redirecting
>
> 		>[2]/dev/null
>
> 	would not be a novel idea.

this is not sufficient because listen still syslogs.  /sys/log/listen gets large
in a hurry.  and in any event, i wouldn't want to lose messages.
furthermore, the spinning listens create quite a load on the system.

this test seems to be treating a symptom, not the root cause.
(a more accurate test would be "psu -a | grep 'listen \[tcp' ")
i'm not sure how we could get this situation unless either cpurc
is run twice or the specific startup starts listen itself with a
different directory specified.

so, how to attack the root causes....

since i still use the big case statement style, listen is either
started in one of the specific cases or case *.  either way,
it's started once.  so with the way sources organizes cpurc,
double-start of listen could be avoided by requiring any
/cfg/$sysname/cpurc to start listen itself and adding an
if not case.

	# cpu-specific startup
	if(test -e /cfg/$sysname/cpurc)
		. /cfg/$sysname/cpurc	# must start listen, if desired
	if not{
		aux/listen -q tcp
		# we don't use IL, maybe you do
		aux/listen -q il
	}

(it might be that this should be moved after the ip configuration.)

if you don't like the code duplication perhaps cpurc could define
	fn defaultlisten {
		aux/listen -q tcp
		aux/listen -q il
	}
etc.

to prevent cpurc from being run twice (which users have done!),
i added the following few lines to the beginning of cpurc

	#!/bin/rc

	if(! ~ $#boottime 0 && ! ~ $#sysname 0){
		echo dont run cpurc on $sysname >[1=2]
		exit boofhead
	}

- erik



      reply	other threads:[~2013-04-28 13:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-28 11:57 lucio
2013-04-28 13:37 ` erik quanstrom [this message]

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=66c1a6c0c3b28769951c2f9c2398451f@brasstown.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /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 NNTP newsgroup(s).