9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: jmk@plan9.bell-labs.com
To: 9fans@cse.psu.edu
Subject: Re: [9fans] bootup menus...
Date: Sat,  6 Aug 2005 12:52:13 -0400	[thread overview]
Message-ID: <727c1cb3f5c1ad03aed5be71ecb2aaa5@plan9.bell-labs.com> (raw)
In-Reply-To: <42F4D749.2000405@moseslake-wa.com>

Others have pointed out boot(8), init(8) for documentation.
A plan9.ini file to do what you want with a 5 second timeout
and serial console might look something like this:

[menu]
menuitem=9pccpu, 9pccpu
menuitem=manual, manual
menuconsole=0, 9600
menudefault=9pccpu, 5

[9pccpu]
bootfile=ether0!/386/9pccpu

[manual]

[common]
ether0=type=i82557
console=0


Locally we run a different cpurc which calls out to local files:

#!/bin/rc
boottime=`{date}
boottime=$"boottime

# parallelism for mk
NPROC=`{wc -l /dev/sysstat}
NPROC=`{echo $NPROC|sed 's/ .*//'}

# get rid of need for dirs in /n
mntgen -s slashn && chmod 666 /srv/slashn

# cs sets /dev/sysname
ndb/cs
sysname=`{cat /dev/sysname}
prompt=($sysname^'# ' '	')

# site specific startup
if(test -e /rc/bin/cpurc.local)
	. /rc/bin/cpurc.local

# cpu specific startup
if(test -e /cfg/$sysname/cpurc)
	. /cfg/$sysname/cpurc

# if we're not a server, start a dns resolver
if(! test -e /srv/dns)
	ndb/dns -r

# reboot if we lose the file server
aux/reboot

# turn on dong's tcp port hog defense
if( test -e /net/tcp/clone)
	echo -n tcpporthogdefense on > /net/tcp/0/ctl

# keep other bootes processes from creating capabilities
rm '#¤/caphash' > /dev/null >[2=1]

# start up internet if we don't already have an address
if(! grep u /net/ipselftab | grep -sv 127.0.0.1)
	ip/ipconfig
if(! grep -s 127.0.0.1 /net/ipselftab)
	ip/ipconfig loopback /dev/null 127.1

# start listeners if it hasn't already been done (dicey check)
if(! netstat -n | grep -s 'tcp.*Listen.* (7|9|21|22|23|25|110|113|565|993|17007|17009|17010) .*')
	aux/listen -q tcp
if(! netstat -n | grep -v 17008 | grep -s il.*Listen)
	aux/listen -q il

if(! ps|grep -s timesync)
	aux/timesync -s /net -nl -d /sys/log/timesync.d oncore achille

# cpu specific startup
if(test -e /cfg/$sysname/cpustart)
	. /cfg/$sysname/cpustart

exit 0


/rc/bin/cpurc.local contains things like setting the
site, fileserver, facedom and default cpu variables and
anything else which is global to our site.

/cfg/$sysname/cpurc contains things specific to a
particular cpu server, such as starting daemons and
cron.

/cfg/$sysname/cpustart seems to be something added
since last I looked to give people another hook for
playing around. Some of the local instances seem to
be of dubious value...

We also use /cfg/$sysname to keep other machine-specific
files such as namespace, consoledb, copies of config
files like plan9.ini, venti.conf, etc. Sometimes there's
also a file of notes about the machine to aid in
recovery or replication if something bad happens.

--jim


  parent reply	other threads:[~2005-08-06 16:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-06 15:29 John Floren
2005-08-06 15:19 ` Christoph Lohmann
2005-08-06 16:52 ` jmk [this message]
2005-08-07  1:48   ` John Floren
2005-08-06 18:32 ` Tim Newsham

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=727c1cb3f5c1ad03aed5be71ecb2aaa5@plan9.bell-labs.com \
    --to=jmk@plan9.bell-labs.com \
    --cc=9fans@cse.psu.edu \
    /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).