home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXTSTEP 3.0
/
NeXTSTEP3.0.iso
/
private
/
etc
/
rc.standD6E
< prev
next >
Wrap
Text File
|
1992-05-28
|
16KB
|
498 lines
#!/bin/sh -u
#
# This is the multi-user startup script.
#
# Copyright (C) 1992 by NeXT Computer, Inc. All rights reserved.
#
# Note that all "echo" commands are in parentheses so that
# the main shell does not open a tty and get its process group set.
HOME=/; export HOME
PATH=/etc:/usr/etc:/bin:/usr/bin; export PATH
# Are we booting from a CD-ROM? If so, switch over to /etc/rc.cdrom.
if [ -d /NextCD -a -D89tc/rc.cdrom ]; then
sh /etc/rc.cdrom $1
echo "CD-ROM boot procedure complete. Shutting down..."
/etc/halt -e
exit 0
fi
# Determine if the network is up; this is used later when deciding
# whether various daemons should run. netstat -i enumerates all the
# known interfaces. Those with a '*' in their names are configured down.
# Count the interfaces which are up.
NINTERFACES=`/usr/ucb/netstat -i | egrep -v '^Name|\*' | /usr/ucb/wc -l`
# The loopback interface is always enabled. Only if we find other
# interfaces do we think we are really connected to a network.
if [ $NINTERFACES -ne 1 ]; then
NETWORKUP=-YES-
else
NETWORKUP=-NO-
fi
# Print out an appropriate message. MESSAGE is used later in the log.
if [ $1x = autobootx ]; then
# (echo Automatic reboot in progress...) >/dev/console
MESSAGE="Reboot"
else
(echo Multiuser startup in progress...) >/dev/console
MESSAGE="Multi-user startup"
fi
# Check for and mount swapdisks.
sh /etc/rc.swap $1
# Mount local filesystems (according to /etc/fstab).
mount -vat 4.3 >/dev/console 2>&1
# Display a message in the iconic boot window.
fbshow -A -B -E -I "Checking*System*Files..."
# Attempt to recover the passwd file, if needed. This procedure is
# primarily historical and makes sense only when the passwd file is edited
# using the vipw command.
if [ -s /etc/ptmp ]; then
if [ -s /etc/passwd ]; then
(echo 'Passwd file conflict with ptmp:') >/dev/console
ls -l /etc/passwd /etc/ptmp >/dev/console
(echo 'Moving ptmp to ptmp.save.') >/dev/console
mv -f /etc/ptmp /etc/ptmp.save
else
(echo 'Passwd file recovered from ptmp.') >/dev/console
mv /etc/ptmp /etc/passwd
fi
elif [ -r /etc/ptmp ]; then
(echo 'Removing passwd lock file') >/dev/console
/bin/rm -f /etc/ptmp
fi
# Start the virtual memory system.
/usr/etc/mach_swapon -av >/dev/console 2>&1
(echo -n 'Cleaning up:') >/dev/console
# If the shutdown command was used to shut the system down, the file
# /etc/nologin may have been created to prevent users from logging in.
# Remove it so that logins are enabled when the system comes up.
/bin/rm -f /etc/nologin
(echo -n ' /etc/nologin') >/dev/console
# Reset pseudo-terminals (ptys) to their default states.
/usr/etc/chown root.tty /dev/tty[pqrs]*
/bin/chmod 666 /dev/tty[pqrs]*
(echo -n ' ptys') >/dev/consoleD8@Recover files being edited by ex, vi, or e when the system was restarted.
(cd /tmp; /usr/lib/ex3.7preserve -a)
(echo -n ' editors') >/dev/console
# Clean out /tmp.
(cd /tmp; find . ! -name . ! -name lost+found ! -name quotas \
-exec rm -r - {} \; )
(echo -n ' /tmp') >/dev/console
# Clear empty subdirectories of /Net.
(cd /private/Net; find . ! -name . -type d -exec rmdir {} \; )
# Clear symlinks from /Net, too.
(cd /private/Net; find . ! -name . -type l -exec rm {} \; )
(echo -n ' /Net') >/dev/console
(echo '.') >/dev/console
# Syslog must be started before daemons are launched from rc.local.
# This allows appropriate log messages to find their way to the console.
(echo -n Starting early daemons:) >/dev/console
if [ -f /usr/etc/syslogd -a -f /etc/syslog.conf ]; then
/bin/rm -f /dev/log
# If you want a timestamp to be logged periodically,
# modify the invocation of syslogd below. For example,
# for a half-hourly timestamp, add the argument "-m30".
/usr/etc/syslogd && (echo -n ' syslogd') >/dev/console
fi
(echo '.') >/dev/console
# Read the configuration information set by the HostManager application.
. /etc/hostconfig
# Set up NIS domain.
if [ "${YPDOMAIN=-NO-}" != "-NO-" -a $NETWORKUP = "-YES-" ]; then
(echo "Setting NIS domainname to $YPDOMAIN") >/dev/console
domainname $YPDOMAIN >/dev/console 2>&1
fi
# Rpc and net services are the minimal set needed to use the network.
(echo -n 'Starting RPC and network services:') >/dev/console
# Start the Mach network message server, which forwards Mach IPC over the
# network and provides a name-to-port mapping service.
if [ -f /usr/etc/nmserver ]; then
/usr/etc/nmserver & >/dev/console 2>&1
(echo -n ' nmserver') >/dev/console
fi
# portmap converts Sun RPC program numbers into IP port numbers.
if [ -f /usr/etc/portmap ]; then
/usr/etc/portmap && (echo -n ' portmap') >/dev/console
fi
# Turn on IP routing. If an explicit route is specified (the '*'
# clause), either an IP address must be used or the router's hostname
# and IP address must be specified in the /etc/hosts file.
case ${ROUTER=-NO-} in
-ROUTED-)
if [ -f /usr/etc/routed -a $NETWORKUP = "-YES-" ]; then
/usr/etc/routed && (echo -n ' routed') >/dev/console
fi
;;
-NO-)
;;
*)
if [ -f /usr/etc/route ]; then
/usr/etc/rD8A add default $ROUTER 1 >/dev/console 2>&1
fi
;;
esac
# Start up the netinfo daemons. This will only complete when the
# local domain has bound to its parent domain, if it has a parent
# (that is, if the machine is on a NetInfo network). The message:
#
# Still searching for parent network administration (NetInfo) server.
# Please wait, or press 'c' to continue without network user accounts.
# See your system administrator if you need help.
#
# comes from the local domain's netinfod; typically, you can wait a minute
# or two and the local domain will eventually find a parent. As the
# message says, the system is still searching for a parent server.
# Typing 'c' aborts that search, which is probably not what you want.
# (You're most likely to see this message on a network-wide NetInfo server.)
#
# If you would like to customize this message to include the name or
# telephone number of a network administrator, edit the text of the
# message in /usr/lib/NextStep/Resources/English.lproj/NetInfo.strings,
# or its equivalent for your usual boot language.
if [ -f /usr/etc/nibindd ]; then
/usr/etc/nibindd && (echo -n ' netinfo') >/dev/console 2>&1
fi
# If we are in an NIS domain, start up the appropiate services.
if [ "$YPDOMAIN" != "-NO-" -a $NETWORKUP = "-YES-" ]; then
# ypserv is run on NIS servers - machines with an /etc/yp/XXX dir
if [ -f /usr/etc/ypserv -a -d /etc/yp/$YPDOMAIN ]; then
/usr/etc/ypserv && (echo -n ' ypserv') >/dev/console
fi
if [ -f /usr/etc/ypbind ]; then
/usr/etc/ypbind && (echo -n ' ypbind') >/dev/console
fi
fi
# The lookup daemon, lookupd, provides information to client programs
# through the standard C library (such as gethostbyname()). It obtains
# the information from various network services: NetInfo, DNS (also called
# the Domain Name Service - named - and BIND), and NIS.
if [ -f /usr/etc/nibindd -a -f /usr/etc/lookupd ]; then
/usr/etc/lookupd && (echo -n ' lookupd') >/dev/console
fi
# Start up time service. If you're doing any sort of network file
# access, be sure NTP is enabled and properly configured, or you may
# see very strange errors and file consistency problems.
#
# NeXT's ntpd has been modified to acquire the NTP server
# configuration from NetInfo (the /locations/ntp directory).
case ${TIME=-AUTOMATIC-} in
-AUTOMATIC-)
if [ -f /usr/eD8Btpd -a $NETWORKUP = "-YES-" ]; then
# Synchronize our clock to the network's time.
/usr/etc/ntp -F >/dev/null
# Fire off ntpd to keep the clock in sync.
/usr/etc/ntpd && (echo -n ' ntpd') >/dev/console
fi
;;
-NO-)
;;
*)
;;
esac
# biod is the NFS asynchronous block I/O daemon, which implements
# NFS read-ahead and write-behind caching on NFS clients.
if [ -f /usr/etc/biod -a $NETWORKUP = "-YES-" ]; then
/usr/etc/biod 4 && (echo -n ' biod') >/dev/console
fi
(echo '.') >/dev/console
# Mount remote filesystems.
fbshow -A -B -E -I "Mounting*File*Systems..."
(echo 'Mounting remote filesystems') >/dev/console
mount -at nfs >/dev/console 2>&1
fbshow -A -B -E -I "Starting*System*Services..."
# Fileservice daemons are needed to import and export filesystems.
(echo -n 'Starting file service daemons:') >/dev/console
# If AppleTalk (EtherTalk) is desired, start up the AppleTalk daemon.
if [ -f /usr/etc/atalkd ]; then
if /usr/etc/atalkd >/dev/console 2>&1; then
(echo -n ' atalkd') >/dev/console
fi
fi
# Start the automounter only if /Net is a directory that is not
# a symlink (symlinks to directories qualify as directories to test's
# -d operation).
if [ -h /Net -o -f /Net ]; then
(echo "Warning: NeXT NFS automounter did not run.") >/dev/console
else
if [ -f /usr/etc/autonfsmount -a $NETWORKUP = "-YES-" ]; then
# The autonfsmounter will attempt a remount every 10 seconds,
# cache names for 12 hours [43200 seconds], mount things in
# /private/Net, ignore any NIS auto.master map, be triggered
# by references in the /Net directory, and use the fstab
# map (i.e., look in the mounts database -- /mounts in NetInfo,
# for example) to locate remote filesystems.
/usr/etc/autonfsmount -tm 10 -tl 43200 \
-a /private -m /Net -fstab \
&& (echo -n ' autonfsmount') >/dev/console 2>&1
fi
fi
# If exportfs finds something to export (either using /etc/exports or the
# exports NetInfo directory), then start the NFS daemons (which service
# NFS requests) and the mount server (which services NFS mount requests).
if [ -f /usr/etc/exportfs ]; then
# Clear the table of exported filesystems before running exportfs.
> /etc/xtab
if /usr/etc/exportfs -a >/dev/console 2>&1; then
# There is no "right" number of nfsd's. Infrequently-accessed
D8Cervers can get by with 4 or fewer. 8 is not excessive for
# heavily-loaded servers.
/usr/etc/nfsd 6 && (echo -n ' nfsd') >/dev/console
/usr/etc/rpc.mountd && (echo -n ' rpc.mountd') >/dev/console 2>&1
fi
fi
# If AppleShare is desired, start up the AppleShare daemon.
if [ -f /usr/etc/ashared ]; then
if /usr/etc/ashared >/dev/console 2>&1; then
(echo -n ' ashared') >/dev/console
fi
fi
# If we are a Network Master become a BOOTP and BOOTPARAM server. This is
# the only thing that depends on the value of NETMASTER from /etc/hostconfig.
if [ "${NETMASTER=-NO-}" = "-YES-" ]; then
# If /etc/bootptab file exists, become a BOOTP server. Note
# that bootpd gets information from /etc/bootptab even when
# NetInfo is running (the per-client information comes from
# NetInfo; the global information comes from /etc/bootptab).
if [ -f /usr/etc/bootpd -a -f /etc/bootptab ]; then
/usr/etc/bootpd && (echo -n ' bootpd') >/dev/console
fi
# bootparamd doesn't need a flat file.
if [ -f /usr/etc/rpc.bootparamd ]; then
/usr/etc/rpc.bootparamd && \
(echo -n ' rpc.bootparamd') >/dev/console
fi
fi
(echo '.') >/dev/console
# Network daemons provide service to the outside world.
(echo -n Starting network daemons:) >/dev/console
# Run the Internet server daemon.
if [ -f /usr/etc/inetd ]; then
/usr/etc/inetd && (echo -n ' inetd') >/dev/console
fi
# Remove junk from the outbound mail queue directory and start up
# the sendmail daemon. /usr/spool/mqueue is assumed here even though
# it can be changed in the sendmail configuration file.
#
# sendmail is started even if there's no configuration file
# in /etc/sendmail/sendmail.cf. sendmail can find a configuration file
# based on information in NetInfo (the sendmail.cf property in the
# /locations/sendmail directory). If no sendmail configuration file
# exists, sendmail will exit with an appropriate error message.
#
# Any messages which end up in the queue, rather than being delivered
# or forwarded immediately, will be processed once each hour.
if [ -f /usr/lib/sendmail ]; then
(cd /usr/spool/mqueue; rm -f nf* lf*)
/usr/lib/sendmail -bd -q1h 2>/dev/console && \
(echo -n ' sendmail') >/dev/console
fi
# lpd is the Berkeley line printer daemon.
if [ -f /usr/lib/lpd ]; then
rm -f /dev/printer
/usr/lib/lpd && (echo -n ' printeD8D >/dev/console
fi
# Start an SNMP agent if configured to do so.
if [ -f /usr/etc/snmpd ]; then
if /usr/etc/snmpd -N >/dev/console 2>&1; then
(echo -n ' snmpd') >/dev/console
fi
fi
(echo '.') >/dev/console
# NeXT services support the application environment
(echo -n 'Starting NeXT services:') >/dev/console
# The pasteboard server is used by the AppKit.
if [ -f /usr/etc/pbs ]; then
/usr/etc/pbs && (echo -n ' pbs') >/dev/console
fi
# exec_faxes starts up any appropriate fax modem daemons.
if [ -f /usr/lib/NextPrinter/exec_faxes ]; then
/usr/lib/NextPrinter/exec_faxes && (echo -n ' exec_faxes') >/dev/console
fi
# If ISDN Networking is desired, start up the PhoneConnector in daemon mode.
/usr/bin/niutil -read . /localconfig/ISDN/Networking >/dev/null 2>&1
if [ $? -eq 0 ]; then
if [ -f /NextAdmin/PhoneConnector.app/PhoneConnector ]; then
/NextAdmin/PhoneConnector.app/PhoneConnector -Daemon YES && \
(echo -n ' PhoneConnector') >/dev/console
fi
fi
(echo '.') >/dev/console
# If NetWare Networking is desired, start it.
( /usr/bin/niutil -read . /localconfig/NetWare | \
/usr/bin/egrep 'enable.+YES' ) >/dev/null 2>&1
if [ $? -eq 0 ]; then
(echo -n "Starting NetWare:") >/dev/console 2>&1
# Load and start the kernel server.
if [ -f /usr/lib/kern_loader/nuc/nuc_reloc ]; then
/usr/etc/kl_util -a /usr/lib/kern_loader/nuc/nuc_reloc \
>/tmp/nuc_log 2>&1
(echo -n ' nuc_reloc ') >/dev/console 2>&1
fi
if [ -f /usr/netware/bin/nucinit ]; then
/usr/netware/bin/nucinit >/dev/console 2>&1
(echo -n ' nucinit') >/dev/console 2>&1
fi
# Configure the protocol stack.
if [ -f /usr/netware/etc/npsd ]; then
/usr/netware/etc/npsd && (echo -n ' npsd') >/dev/console 2>&1
fi
# Start the Management Portal, an internal port for communicating
# with the kernel server.
if [ -f /usr/netware/bin/nwmp ]; then
/usr/netware/bin/nwmp start && (echo -n ' nwmp') >/dev/console 2>&1
fi
# Start the Netware Service Advertisement Protocol Daemon, which looks for
# NetWare servers' advertisement packets.
if [ -f /usr/netware/etc/sapd ]; then
/usr/netware/etc/sapd && (echo -n ' sapd') >/dev/console 2>&1
fi
# Start the NetWare automounter.
if [ -f /usr/etc/autoNetWaremount ]; then
/usr/etc/autoNetWaremount && (echoD8E' autoNetWaremount') \
>/dev/console 2>&1
fi
(echo '.') >/dev/console
fi
# InputManager startup procedure (Japanese)
if [ -d /NextLibrary/InputManager ]; then
(echo -n 'Starting input servers:') >/dev/console
for i in /NextLibrary/InputManager/*
do
if [ -d $i ]; then
if [ $i = "/Nextlibrary/InputManager/Resources" ]; then
continue
fi
rcfile=`basename $i`
if [ -f $i/${rcfile}.rc ]; then
sh $i/${rcfile}.rc $1
fi
fi
done
(echo '.') >/dev/console
fi
# Any customizations to the startup sequence you would like to make should
# be placed in /etc/rc.local; this way they can be preserved when your
# system is later upgraded to a new version of system software.
if [ -f /etc/rc.local ]; then
sh /etc/rc.local $1
fi
# Unlock tip lines. tip and UUCP share lock files so they don't get in
# each other's way.
if [ -d /usr/spool/uucp ]; then
rm -f /usr/spool/uucp/LCK.*
rm -f /usr/spool/uucp/LCK/LCK.*
fi
# Start standaard daemons that should always run
(echo -n Starting standard daemons:) >/dev/console
# update flushes the cached blocks from the filesystem using
# the sync system call every 30 seconds. This ensures the
# disk is reasonably up-to-date in the event of a system crash.
update && (echo -n ' update') >/dev/console
# cron executes commands listed in /etc/crontab at specified times.
cron && (echo -n ' cron') >/dev/console
# accton is here for historical reasons.
# if [ -f /usr/adm/acct ]; then
# accton /usr/adm/acct && (echo -n ' accounting') >/dev/console
# fi
(echo '.') >/dev/console
# Submit a syslog note to indicate that we've successfully rebooted.
/usr/ucb/logger -t reboot -p kern.crit "$MESSAGE complete"
exit 0