Source code upload

This commit is contained in:
calmsacibis995
2022-09-29 17:59:04 +03:00
parent 72fa9da3d7
commit 8fc8fa8089
33399 changed files with 11964078 additions and 0 deletions
+191
View File
@@ -0,0 +1,191 @@
#!/bin/sh
# Note that this script is limited to SCSI drives on integral controllers
# or raid5 controllers
# (that is, not the jaguar or cougar VME SCSI controllers) and defaults to
# controller 0.
# It makes the filesystem on partition 7 (appropriate for option drives),
# creates the mount directory, and an fstab entry for the drive, then mounts it.
CTLR=0 ID=2 LUN=0 # defaults
if [ $# -gt 3 ]
then
echo "Usage $0 [controller] [disk_number] [lun_number]"
exit 1
elif [ $# -eq 3 ]
then
CTLR="$1" ID="$2" LUN="$3"
elif [ $# -eq 2 ]
then
CTLR="$1" ID="$2"
elif [ $# -eq 1 ]
then
ID="$1"
fi
rootdisk="`devnm /|sed 's/[ ].*//`"
if [ $LUN -gt 0 ]
then
DS=dks${CTLR}d${ID}l${LUN}
else
DS=dks${CTLR}d${ID}
fi
DSK=/dev/dsk/${DS}s7
RDSK=/dev/rdsk/${DS}s7
if [ $LUN -gt 0 ]
then
MOUNTPT=/disk$CTLR$ID$LUN
else
MOUNTPT=/disk$CTLR$ID
fi
case "$rootdisk" {
*/dev/dsk/${DS}*)
echo You may not use this for the system disk, only option disks
exit 1
;;
}
if [ $LUN -gt 0 ]
then
hinv -c disk | grep -s "unit $ID, lun $LUN on SCSI controller $CTLR" > /dev/null 2>&1
d=$?
else
hinv -c disk | grep -s "unit $ID on SCSI controller $CTLR" > /dev/null 2>&1
d=$?
fi
hinv -c scsi | grep -s "Optical disk: unit $ID on SCSI controller $CTLR" > /dev/null 2>&1
o=$?
if [ $d -ne 0 -a $o -ne 0 ]
then
if [ $LUN -gt 0 ]
then
echo SCSI disk $ID with lun $LUN not found on controller $CTLR in
echo hardware inventory. If you are sure that you have the right SCSI
echo ID, be sure that the disk is attached and powered up when the
echo system is booted.
else
echo SCSI disk $ID not found on controller $CTLR in hardware inventory
echo If you are sure that you have the right SCSI ID, be sure that the
echo disk is attached and powered up when the system is booted.
fi
exit 1
fi
if [ ! -c /dev/rdsk/${DS}vh ]
then
if [ $LUN -gt 0 ]
then
echo "No volume header device (/dev/rdsk/${DS}vh) found, for disk $ID"
echo with lun $LUN on controller $CTLR. You may need to run the
echo following commands to create the device files:
else
echo "No volume header device (/dev/rdsk/${DS}vh) found, for disk $ID"
echo on controller $CTLR. You may need to run the following commands to
echo create the device files:
fi
echo "\tcd /dev; ./MAKEDEV disks"
exit 1
fi
if prtvtoc /dev/rdsk/${DS}vh > /dev/null 2>&1
then :
else
if [ $LUN -gt 0 ]
then
echo SCSI disk $ID with lun $LUN on controller $CTLR does not appear
echo to be initialized with a Silicon Graphics volume header. You may
echo need to use \"fx\" to initialize it.
else
echo SCSI disk $ID on controller $CTLR does not appear to be initialized
echo with a Silicon Graphics volume header. You may need to use
echo \"fx\" to initialize it.
fi
exit 1
fi
if [ $LUN -gt 0 ]
then
echo "\nAdding SCSI disk $ID with lun $LUN on controller $CTLR"
else
echo "\nAdding SCSI disk $ID on controller $CTLR"
fi
/etc/fsstat $DSK > /dev/null 2>&1
s7=$?
/etc/fsstat /dev/dsk/${DS}s6 > /dev/null 2>&1
s6=$?
/etc/fsstat /dev/dsk/${DS}s0 > /dev/null 2>&1
s0=$?
if [ $s7 -ne 3 -o $s6 -ne 3 -o $s0 -ne 3 ]
then
echo "\007SCSI disk $ID appears to have a valid filesystem, overwrite it? (n)\c"
read answer
case "$answer" {
y|Y|yes|Yes|YES) ;;
*)
if [ $LUN -gt 0 ]
then
echo Disk $ID with lun $LUN on controller $CTLR not added, previous data preserved
else
echo Disk $ID with lun $LUN on controller $CTLR not added, previous data preserved
fi
exit 1;;
}
fi
# unmount it by disk name, in case it is mounted on a different mount pt.
umount $DSK > /dev/null 2>&1
# make the new filesystem; raw device is much faster
mkfs $RDSK > /dev/null 2>&1
if [ $? -ne 0 ]
then
if [ $LUN -gt 0 ]
then
echo Unable to create a filesystem on SCSI disk $ID with lun $LUN on controller $CTLR
else
echo Unable to create a filesystem on SCSI disk $ID on controller $CTLR
fi
exit 1
fi
# create directory
if [ ! -d $MOUNTPT ]
then
rm -f $MOUNTPT
mkdir $MOUNTPT
if [ ! -d $MOUNTPT ]
then
echo Can not make mount directory $MOUNTPT; exit 1
fi
fi
# add the entry to /etc/fstab (ignore commented out lines!)
# make sure that the mount point matches also; if it was mounted
# as something else before, the 2nd mount attempt on next boot
# will at least print an error message
egrep -s "^$DSK[ ][ ]*$MOUNTPT[ ]" /etc/fstab > /dev/null 2>&1
if [ $? -ne 0 ]
then
echo "$DSK $MOUNTPT xfs rw,raw=$RDSK 0 0" >> /etc/fstab
fi
sync
# label the disk with its directory name
## xfs doesn't support labelit
#if [ $LUN -gt 0 ]
#then
#labelit $RDSK disk$CTLR$ID$LUN sgi > /dev/null 2>&1
#else
#labelit $RDSK disk$CTLR$ID sgi > /dev/null 2>&1
#fi
# mount the filesystem
if mount -v $MOUNTPT
then echo "\nNew disk ready to use as $MOUNTPT."; df -lik $MOUNTPT; exit 0
else echo "\007Failed to mount $DSK on $MOUNTPT"; exit 1
fi
+296
View File
@@ -0,0 +1,296 @@
#!/sbin/sh
####
usage()
{
echo "Usage $0 [-h hostname] [-t tapedevice] [-i] directory_name/file_name"
exit 1
}
####
notabspath()
{
echo "you need to specify the absolute pathname for $FILE"
exit 1
}
####
nonrootincr()
{
echo "you can only do incremental backup from root ( / )"
exit 1
}
# matches what the GUI tool uses
make_label() {
( exec 2>/dev/null; \
echo label: "$1"; \
date;echo user: \\c;id -nu; echo group: \\c; id -ng; uname -a;\
ident /sbin/cpio|sed -n -e 's/.*Header: *//' -e 2p;\
echo options: "$2"
) > $LABEL_FILE
}
BDIR=""
TP="/dev/tape"
HN="LOCAL"
FILE=""
INCR="FALSE"
INCR_FILE=/etc/lastbackup # file we use to mark incremental backups
# was the date therein, now it's the modtime of that file.
LABEL_FILE=/tmp/.info_$$ # name should match system recovery and GUI tool
OPTS="$@" # original option string
####
if [ $# -eq 0 ]
then
usage
fi
####
while [ $1 = "-h" -o $1 = "-t" -o $1 = "-i" ]
do
if [ $1 = "-i" ]
then
INCR="TRUE"
shift
if [ $# -lt 1 ]
then
usage
fi
fi
if [ $1 = "-h" ]
then
shift
if [ $# -lt 1 ]
then
usage
fi
HN=$1
shift
if [ $# -lt 1 ]
then
usage
fi
fi
if [ $1 = "-t" ]
then
shift
if [ $# -lt 1 ]
then
usage
fi
TP=$1
shift
if [ $# -lt 1 ]
then
usage
fi
fi
done
####
BDIR="$@"
while [ $# -gt 0 ]
do
FILE=$1
shift
case "$FILE" in
/*)
continue ;;
*) notabspath ;
break ;;
esac
done
####
if [ "$BDIR" != "/" -a "$INCR" = "TRUE" ]
then
nonrootincr
fi
if [ $HN = "LOCAL" ]
then
ret=`mt -t $TP status 2>&1`
else
ret=`(/usr/etc/ping -s 1 -c 1 $HN 2>&1)`
case "$ret" {
*100%?packet?loss*) echo "Error: Unable to communicate with host:" "$HN" ;
exit 1;;
}
# do not use remote mt for historical reasons.
ret=`(rsh $HN -n -l guest mt -t $TP status 2>&1)`
fi
case "$ret" {
*Login?incorrect*) echo "Error: guest login incorrect on:" "$HN" ;
exit 1 ;;
*No?such?file*) echo "Error: Tape device $TP not configured." ;
exit 1 ;;
*Not?READY*) echo "Error: There is no tape in the drive." ;
exit 1 ;;
*write?protected*) echo "Error: The tape is write protected." ;
exit 1 ;;
*Unknown?host*) echo "Error: Host $HN is unknown." ;
exit 1 ;;
*can*get?status*) echo "Error: Cannot stat $TP." ;
exit 1 ;;
*I/O?error*) echo "Error: Unable to I/O on $TP." ;
exit 1 ;;
}
####
# set here even for incrementals, so rm in trap doesn't get an error
tabfiles=tmp/mtab # tabfiles need to be relative for restore script
# and so cpio sorts them to front of tape from cmdline args
sleep 2
echo ""
echo "Backup started. Please wait..."
trap 'cd /; rm -rf $tabfiles $LABEL_FILE; trap 0; exit 0' 0
trap 'cd /; echo Backup interrupted; rm -rf $tabfiles $LABEL_FILE; trap 0; exit 1' 1 2
if [ $HN = "LOCAL" ]
then
TPDEV="$TP"
else
TPDEV="guest@$HN:$TP"
fi
INCR_DATE="`stat -m $INCR_FILE 2>/dev/null | \
sed -e 's/.*[ ]modify time - //' -e 's/[ ]*<.*//' `"
if [ -z "$INCR_DATE" ]; then
if [ "$INCR" = "TRUE" ]; then
echo No incremental file $INCR_FILE, doing full backup
INCR=FALSE
fi
fi
if [ "$BDIR" = "/" ]
then
cd /
if [ "$INCR" = "TRUE" ]
then
cat /dev/null > /tmp/mtab
while read dev dir typ rest
do
if [ "$typ" = "efs" -o "$typ" = xfs ]
then
echo "$dev $dir $typ" >> /tmp/mtab
fi
done < /etc/mtab
make_label "Incremental Backup of files modified since $INCR_DATE from $BDIR" \
"/sbin/cpio -KWovO $TPDEV"
(echo $LABEL_FILE; for i in $tabfiles; do echo $i; done; \
find . -local -depth -newer "$INCR_FILE" ! -type s -print) | \
/sbin/cpio -KWovO $TPDEV
exitstat=$?
else
make_label "Full system backup from /" "/sbin/cpio -KWovO $TPDEV"
# ignore the volhdr lv and xlv files, and the files that are no longer
# in /stand, and that we handle specially below
dvhtool -v list | grep '[0123456789]' | sed \
-e /lvtab/d -e /xlvlab/d -e /sash/d -e /ide/d -e /symmon/d \
-e /sgilabel/d -e 's/^[ ]*//' -e 's/[ ].*//' > /tmp/volhdrlist
tabfiles="$tabfiles tmp/volhdrlist"
cat /dev/null > /tmp/mtab
while read dev dir typ rest
do
if [ "$typ" = "efs" -o "$typ" = xfs ]
then
echo "$dev $dir $typ" >> /tmp/mtab
fi
done < /etc/mtab
if [ -s /etc/lvtab ]
then cp /etc/lvtab /tmp
tabfiles="$tabfiles tmp/lvtab"
fi
# check if xlv volumes exist, if so store info
if [ -d /dev/dsk/xlv ]
then
set `ls /dev/dsk/xlv | wc`
if [ $1 -ne 0 ]
then
# xlv vols exist - store config and the list
/bin/ls /dev/dsk/xlv > /tmp/xlv_vollist
echo "script all\nquit\n" | xlv_mgr > /tmp/xlv_config_script
tabfiles="$tabfiles tmp/xlv_vollist tmp/xlv_config_script"
fi
fi
# check if quotas are on, if so store quota info
if [ -a /etc/init.d/quotas ]
then
repquota -s -a > /dev/null 2> /dev/null
if [ $? ]
then
repquota -s -a 2>&1 | \
grep -q 'user quota accounting.*off'
if [ $? -ne 0 ]
then
repquota -e /tmp/quotatab -a
tabfiles="$tabfiles tmp/quotatab"
fi
fi
fi
mkdir /var/tmp/_sgi_stand_$$
if [ ! -d /var/tmp/_sgi_stand_$$ ]
then echo Warning: unable to save copy of volume header files
else
dvhtool -v g sash /var/tmp/_sgi_stand_$$/sash
if [ ! -f /var/tmp/_sgi_stand_$$/sash ]
then echo Warning: not able to save copy of volume header sash
fi
# not all systems have ide or symmon, and not crucial
dvhtool -v g ide /var/tmp/_sgi_stand_$$/ide >/dev/null 2>&1
dvhtool -v g symmon /var/tmp/_sgi_stand_$$/symmon >/dev/null 2>&1
echo /var/tmp/_sgi_stand_$$ > /tmp/vh_savedir
tabfiles="$tabfiles tmp/vh_savedir"
fi
# The tabfiles all get backed up twice, but we want them to be at
# the beginning, so it's no big deal.
(echo $LABEL_FILE; for i in $tabfiles; do echo $i; done;
find . -local -depth ! -type s -print) | \
/sbin/cpio -KWovO $TPDEV
exitstat=$?
if [ $exitstat -eq 0 ]
then date +%D > $INCR_FILE
else echo $0 failed "(exit status $?)", $INCR_FILE not updated
fi
fi
else
if [ -d "$BDIR" ]
then
cd $BDIR
findarg=.
else # allow backup of specific file(s), but not with spaces in name
# label file will show working dir backup started from, which
# isn't very useful since the file has a full pathname, but it's
# a minor inconsistency that has no clear "correct" answer.
findarg="$BDIR"
fi
BDIR="`/bin/pwd`"
make_label "Selected Files Backup from $BDIR" "/sbin/cpio -KWovO $TPDEV"
(echo $LABEL_FILE; find $findarg -local -depth ! -type s -print) | \
/sbin/cpio -KWovO $TPDEV
exitstat=$?
fi
echo ""
echo "Backup complete."
exit $exitstat
+184
View File
@@ -0,0 +1,184 @@
#!/sbin/sh
####
usage()
{
echo "Usage $0 [-v] [-h hostname] [-t tapedevice]"
exit
}
####
TP="/dev/tape"
HN="localhost"
FILE=""
bruv= tarv= cpiov= # verify options
####
if [ $# -gt 0 ]
then
while [ $1 = "-h" -o $1 = "-t" -o $1 = "-v" ]
do
if [ $1 = "-h" ]
then
shift
if [ $# -lt 1 ]
then
usage
fi
HN=$1
shift
if [ $# -lt 1 ]
then
break
fi
fi
if [ $1 = "-t" ]
then
shift
if [ $# -lt 1 ]
then
usage
fi
TP=$1
shift
if [ $# -lt 1 ]
then
break
fi
fi
if [ $1 = "-v" ]
then
shift
bruv=d tarv=C cpiov=TT # verify options
fi
done
fi
####
if [ $HN = "localhost" ]
then
ret=`mt -t $TP status 2>&1`
else
ret=`(/usr/etc/ping -s 1 -c 1 $HN 2>&1)`
case "$ret" {
*100%?packet?loss*) echo "Error: Unable to communicate with host:" "$HN" ;
exit ;;
}
ret=`(rsh guest@$HN -n mt -t $TP status 2>&1)`
fi
case "$ret" {
*Login?incorrect*) echo "Error: guest login incorrect on:" "$HN" ;
exit ;;
*No?such?file*) echo "Error: Tape device $TP not configured." ;
exit ;;
*Not?READY*) echo "Error: There is no tape in the drive." ;
exit ;;
*Unknown?host*) echo "Error: Host $HN is unknown." ;
exit ;;
*can*get?status*) echo "Error: Cannot stat $TP." ;
exit ;;
*I/O?error*) echo "Error: Unable to I/O on $TP." ;
exit ;;
}
sleep 2
if [ $HN = "localhost" ]
then
TPDEV="$TP"
else
TPDEV="guest@$HN:$TP"
fi
# function to determine tape type.
# assumes blocksize never > 256KB
get_backup_type() {
rsh guest@$HN -n dd if=$TP bs=256k count=1 > /tmp/$$type 2>/dev/null
LANG=C ttype="`file /tmp/$$type`"
case "$ttype" {
*bru*) echo Backup is a bru archive
labelcmd="bru -g -f /tmp/$$type"
listcmd="bru -tvj$bruv -f $TPDEV"
;;
*xfsdump*) echo Backup is an xfsdump archive
labelcmd=
# no verify option
listcmd="xfsrestore -v verbose -t -f $TPDEV"
;;
*cpio*) echo Backup is a cpio archive
labelcmd="cpiolabel /tmp/$$type"
listcmd="cpio -itvk$cpiov -I $TPDEV"
;;
*tar*) echo Backup is a tar archive
labelcmd="tarlabel /tmp/$$type"
listcmd="tar -vtRf$tarv $TPDEV"
;;
*) echo Unable to determine backup type, assuming cpio
labelcmd="cpiolabel /tmp/$$type"
listcmd="cpio -itvk$cpiov -I $TPDEV"
;;
}
}
# get label from a tar tape.
# since tar has no real labels, we simply fake this one.
# if it's written in the "sgi system backup format", it
# has such a label, otherwise we fake it.
# basicly, we assume the first file is small, and extract it.
tarlabel()
{
file="`tar Rtf $1 2>&1 | sed -n 1p`"
if [ $? -ne 0 ] #{
then
echo "Error trying to read label file"
return 0
fi #}
# get the label file; first file on tape
(cd /; tar Rxf $1 $file 2>/dev/null; if [ -f "$file" ];
then cat $file; rm -f $file; fi)
return 1;
}
# get label from a cpio tape.
# since tar has no real labels, we simply fake this one.
# if it's written in the "sgi system backup format", it
# has such a label, otherwise we fake it.
# basicly, we assume the first file is small, and extract it.
cpiolabel()
{
file="`cpio -ti -I $1 2>&1 | sed -n 1p`"
if [ $? -ne 0 ] #{
then
echo "Error trying to read label file"
return 0
fi #}
# get the label file; first file on tape
(cd /; cpio -i -I $1 $file >/dev/null 2>&1; if [ -f "$file" ];
then cat $file; rm -f $file; fi)
return 1;
}
trap 'rm -f /tmp/$$type /tmp/$$lab; trap 0; exit 0' 0
trap 'echo Interrupted; rm -f /tmp/$$type; trap 0; exit 1' 1 2
echo ""
echo "Tape listing started. Please wait..."
get_backup_type
$labelcmd | tee /tmp/$$lab
# if they asked for verify, try to start from same dir. This shouldn't
# be an issue if made through Backup, but may be done through other scripts
if [ -n "$cpiov" ]
then
sdir="`sed -n /label:/'s/.* //p' /tmp/$$lab`"
if [ -n "$sdir" ]; then
cd $sdir # may not work right if there was no label file...
fi
fi
echo ""
$listcmd
echo ""
echo "Tape listing complete."
+12
View File
@@ -0,0 +1,12 @@
#ident "$Revision: 1.16 $"
include $(ROOT)/usr/include/make/commondefs
SCRIPTS =Backup Restore List_tape Add_disk
default:$(SCRIPTS)
include $(COMMONRULES)
install: default
$(INSTALL) -u root -g sys -F /usr/sbin -m 755 "$(SCRIPTS)"
+158
View File
@@ -0,0 +1,158 @@
@(#)sadmin:README 2.3 /sccs/src/cmd/sadmin/s.README
%W%
Simple Administration (sadmin) software
UPDATING A PREVIOUSLY INSTALLED SIMPLE ADMINISTRATION
If a previous installation of sadmin is in place and you intend to
replace that one with a new one, perform the following sequence to remove
the installed product, clobber intermediate files in the source tree,
remove the previous source files and remove the source tree directory
structure. See the note about INSTALLING UNDER A DIFFERENT ROOT, below.
make -f sadmin.mk ROOT=`pwd`/installdir remove clobber
rm -f `make -f sadmin.mk partslist`
find * -type d -print | sort -r | xargs rmdir
Then install all the new source files and follow the instructions below.
It is possible to install new source without going through this sequence,
but there is a chance that it won't work because of name collisions and the
like. This is guaranteed to give a clean sweep and properly build the product.
INSTALLATION INSTRUCTIONS
All source files are installed under a single directory, traditionally
/usr/src/cmd/sadmin.
All the product pieces are built by the issuing the command
make -f sadmin.mk
All the product pieces are installed by the super-user issuing the command
make -f sadmin.mk install
INSTALLING UNDER A DIFFERENT ROOT
The installation above installs relative to /. The relative position of
these files can be modified by adding a ROOT:
make -f sadmin.mk ROOT=`pwd`/installdir install
This will make the file in "installdir" below the current directory.
DO NOT set ROOT=`pwd` ! It will wipe out your source!
On the final system, the following must be done:
/etc/passwd must have the following entries:
sysadm::0:0:general system administration:/usr/admin:/bin/rsh
setup::0:0:first time setup:/usr/admin:/bin/rsh
powerdown::0:0:power down machine:/usr/admin:/bin/rsh
checkfsys::0:0:check diskette file system:/usr/admin:/bin/rsh
makefsys::0:0:make diskette file system:/usr/admin:/bin/rsh
mountfsys::0:0:mount diskette file system:/usr/admin:/bin/rsh
umountfsys::0:0:unmount diskette file system:/usr/admin:/bin/rsh
(This can be found in admin/passwd after the product is built.)
NOTE: This old way of defining removable disk device to SA will work
for a while, but there must be only one such device.
Link /dev/diskette to the largest block device of the diskette
e.g. ln /dev/ifdsk00 /dev/diskette
Link /dev/rdiskette to the largest character device of the diskette
e.g. ln /dev/rifdsk00 /dev/rdiskette
BUG!!! This does not work with System V Release 2 mount(1M) and umount(1M)!
Note: To define one or more removable disk or tape device to SA:
mkdir /dev/SA /dev/rSA
chmod 755 /dev/SA /dev/rSA
In /dev/SA, link the largest block devices for the removable media. Give
them the names you want them to be know as when the user is asked to select
one. E.g.:
ln /dev/dsk/10s1 /dev/SA/diskette1
ln /dev/dsk/11s1 /dev/SA/diskette2
ln /dev/mt/0m /dev/SA/tape0
Similarly, the same must be done for character (raw) devices. E.g.:
ln /dev/rdsk/0s1 /dev/rSA/diskette1
ln /dev/rdsk/1s1 /dev/rSA/diskette2
ln /dev/rmt/0m /dev/rSA/tape0
end BUG!!!
Assuming that
init state 0 takes the machine down and turns off the power
init state 1 takes the machine down and goes to single-user state
init state 2 is traditional multi-user
init state 5 takes the machine down and goes to firmware
init state 6 takes the machine down and reboots UNIX OS
etc/inittab must have the following entries:
3B2 ONLY!!!
s2:2:wait:/etc/rc2 >/dev/console 2>&1 </dev/console
fl:056:wait:/etc/restart -f >/dev/console 2>&1 </dev/console
s0:056:wait:/etc/rc0 >/dev/console 2>&1 </dev/console
of:0:wait:/etc/uadmin 2 0 >/dev/console 2>&1 # turn off power
fw:5:wait:/etc/uadmin 2 2 >/dev/console 2>&1 # return to firmware
RB:6:wait:echo Automatic Reboot >/dev/console 2>&1
rb:6:wait:/etc/uadmin 2 1 >/dev/console 2>&1 # reboot
su:1:wait:/etc/shutdown -is -y -g0 </dev/console >/dev/console 2>&1 # go to single user mode
3B5 ONLY!!!!
s2:2:wait:/etc/rc2 >/dev/console 2>&1 </dev/console
fl:056:wait:/etc/restart -f >/dev/console 2>&1 </dev/console
s0:056:wait:/etc/rc0 >/dev/console 2>&1 </dev/console
of:0:wait:echo You may now turn off the power. >/dev/console 2>&1
fw:5:wait:/etc/restart >/dev/console 2>&1 </dev/console
rb:6:wait:echo You may now reboot UNIX. >/dev/console 2>&1
su:1:wait:/etc/shutdown -is -y -g0 </dev/console >/dev/console 2>&1 # go to single user mode
ALL OTHER MACHINES
s2:2:wait:/etc/rc2 >/dev/console 2>&1 </dev/console
fl:056:wait:/etc/restart -f >/dev/console 2>&1 </dev/console
s0:056:wait:/etc/rc0 >/dev/console 2>&1 </dev/console
of:0:wait:echo You may now turn off the power. >/dev/console 2>&1
fw:5:wait:echo You may now go to firmware. >/dev/console 2>&1
rb:6:wait:echo You may now reboot UNIX. >/dev/console 2>&1
su:1:wait:/etc/shutdown -is -y -g0 </dev/console >/dev/console 2>&1 # go to single user mode
There needs to be a file /etc/fstab .
This file contains the mount information for all file systems (except /)
to be mounted when the machine is in multi-user state.
Its format is tab separated columns.
Column 1 Block special device (e.g. /dev/idsk02)
Column 2 Mount point directory (e.g. /usr)
Column 3 optional -r indicating "mount read-only"
Lines beginning with # are comments.
MISCELLANEOUS make TARGETS
Note:
All the following use the same ROOT conventions as "make install", above.
To list all product files created by "make install", type
make -f sadmin.mk product
To list all product directories created by "make install", type
make -f sadmin.mk productdir
To create a PROTO file, see mkfs(1M), for the product files installed, type
make -f sadmin.mk proto
(This will only work after a make install has been done.)
To list all parts (delivered) files, type
make -f sadmin.mk partslist
To list all commands used within Simple Administration shell scripts, type
make -f sadmin.mk cmdsused
To clean out all intermediate files from the source directories (i.e. *.o), type
make -f sadmin.mk clean
To clean out all intermediate and final product files
from the source directories, type
make -f sadmin.mk clobber
To remove the product files from the installed directories, type
make -f sadmin.mk remove
(This must be done by the same user who issued make install .)
RECOMMENDATIONS:
The agefile(1) command can be used to keep logs from growing without bound.
Add the following line to /var/spool/cron/crontab/root
0 0 * * * /usr/lbin/agefile -h /usr/lib/cron/log /usr/adm/sulog /etc/wtmp
The spacewatch(1) command can be used to watch over "head room" in the file
systems and give warnings BEFORE they actually run out of free blocks or inodes.
A typical cron line in /var/spool/cron/crontab/root
10,40 * * * * /usr/lbin/spacewatch -u -b500 -i100 ALL >/dev/null 2>&1
+176
View File
@@ -0,0 +1,176 @@
#!/sbin/sh
####
usage()
{
echo "Usage $0 [-h hostname] [-t tapedevice] [directory_name/file_name]"
exit
}
####
RDIR=""
TP="/dev/tape"
HN="localhost"
FILE=""
####
if [ $# -gt 0 ]
then
while [ $1 = "-h" -o $1 = "-t" ]
do
if [ $1 = "-h" ]
then
shift
if [ $# -lt 1 ]
then
usage
fi
HN=$1
shift
if [ $# -lt 1 ]
then
break
fi
fi
if [ $1 = "-t" ]
then
shift
if [ $# -lt 1 ]
then
usage
fi
TP=$1
shift
if [ $# -lt 1 ]
then
break
fi
fi
done
fi
####
RDIR="$@"
####
if [ $HN = "localhost" ]
then
ret=`mt -t $TP status 2>&1`
else
ret=`(/usr/etc/ping -s 1 -c 1 $HN 2>&1)`
case "$ret" {
*100%?packet?loss*) echo "Error: Unable to communicate with host:" "$HN" ;
exit ;;
}
ret=`(rsh guest@$HN -n mt -t $TP status 2>&1)`
fi
case "$ret" {
*Login?incorrect*) echo "Error: guest login incorrect on:" "$HN" ;
exit ;;
*No?such?file*) echo "Error: Tape device $TP not configured." ;
exit ;;
*Not?READY*) echo "Error: There is no tape in the drive." ;
exit ;;
*Unknown?host*) echo "Error: Host $HN is unknown." ;
exit ;;
*can*get?status*) echo "Error: Cannot stat $TP." ;
exit ;;
*I/O?error*) echo "Error: Unable to I/O on $TP." ;
exit ;;
}
sleep 2
if [ $HN = "localhost" ]
then
TPDEV="$TP"
else
TPDEV="guest@$HN:$TP"
fi
# function to determine tape type.
# assumes blocksize never > 256KB
get_backup_type() {
rsh guest@$HN -n dd if=$TP bs=256k count=1 > /tmp/$$type 2>/dev/null
LANG=C ttype="`file /tmp/$$type`"
case "$ttype" {
*bru*) echo Backup is a bru archive
labelcmd="bru -g -f /tmp/$$type $RDIR"
xcmd="bru -xvj -ur -f $TPDEV"
;;
*xfsdump*) echo Backup is an xfsdump archive
labelcmd=
xcmd="xfsrestore -v verbose -r -f $TPDEV"
;;
*cpio*) echo Backup is a cpio archive
labelcmd="cpiolabel /tmp/$$type"
xcmd="cpio -iudvk -I $TPDEV $RDIR"
;;
*tar*) echo Backup is a tar archive
labelcmd="tarlabel /tmp/$$type"
xcmd="tar -vxRf $TPDEV $RDIR"
;;
*) echo Unable to determine backup type, assuming tar
labelcmd=tarlabel
xcmd="tar -vxRf $TPDEV $RDIR"
;;
}
}
# get label from a tar tape.
# since tar has no real labels, we simply fake this one.
# if it's written in the "sgi system backup format", it
# has such a label, otherwise we fake it.
# basicly, we assume the first file is small, and extract it.
tarlabel()
{
file="`tar Rtf $1 2>&1 | sed -n 1p`"
if [ $? -ne 0 ] #{
then
echo "Error trying to read label file"
return 0
fi #}
# get the label file; first file on tape
(cd /; tar Rxf $1 $file 2>/dev/null; if [ -f "$file" ];
then cat $file; rm -f $file; fi)
return 1;
}
# get label from a cpio tape.
# since tar has no real labels, we simply fake this one.
# if it's written in the "sgi system backup format", it
# has such a label, otherwise we fake it.
# basicly, we assume the first file is small, and extract it.
cpiolabel()
{
file="`cpio -ti -I $1 2>&1 | sed -n 1p`"
if [ $? -ne 0 ] #{
then
echo "Error trying to read label file"
return 0
fi #}
# get the label file; first file on tape
(cd /; cpio -i -I $1 $file >/dev/null 2>&1; if [ -f "$file" ];
then cat $file; rm -f $file; fi)
return 1;
}
trap 'rm -f /tmp/$$type; trap 0; exit 0' 0
trap 'echo Interrupted; rm -f /tmp/$$type; trap 0; exit 1' 1 2
cd /
get_backup_type
$labelcmd
echo ""
sleep 2
echo "Restore started. Please wait..."
$xcmd
if [ $? = 0 ]
then
echo "\nRestore completed successfully."
else
echo "\nRestore finished; errors occurred during recovery\007"
fi
+48
View File
@@ -0,0 +1,48 @@
#ident "$Header: /proj/irix6.5.7m/isms/eoe/cmd/sadmin/admin/RCS/Makefile,v 1.18 1989/06/09 14:45:34 narula Exp $"
include $(ROOT)/usr/include/make/commondefs
ADMINHOME = /usr/admin
UBIN = /usr/bin
C_CMD= shade
CMDS= setup powerdown sysadm
PARTS = $(CMDS) gettyvalues menu/DESC \
menu/filemgmt/DESC menu/filemgmt/diskuse \
menu/filemgmt/fileage menu/filemgmt/filesize \
menu/machinemgmt/DESC \
menu/machinemgmt/powerdown menu/machinemgmt/reboot menu/machinemgmt/whoson \
menu/syssetup/DESC menu/syssetup/admpasswd \
menu/syssetup/datetime menu/syssetup/nodename menu/syssetup/setup \
menu/syssetup/syspasswd menu/ttymgmt/DESC menu/ttymgmt/lineset \
menu/ttymgmt/mklineset menu/ttymgmt/modtty menu/usermgmt/DESC \
menu/usermgmt/addgroup menu/usermgmt/adduser menu/usermgmt/delgroup \
menu/usermgmt/deluser menu/usermgmt/lsgroup menu/usermgmt/lsuser \
menu/usermgmt/modadduser menu/usermgmt/modgroup/DESC \
menu/usermgmt/modgroup/chgname menu/usermgmt/moduser/DESC \
menu/usermgmt/moduser/chgloginid menu/usermgmt/moduser/chgpasswd \
menu/usermgmt/moduser/chgshell
INSCMD =$(INSTALL) -idb "std.sw.sysadm"
default: $(PARTS) $(C_CMD)
clean:
clobber: clean
rm -f shade
FRC:
install: default
$(INSCMD) -dir $(ADMINHOME)
$(INSCMD) -F $(UBIN) -m 744 $(C_CMD)
$(INSCMD) -ln $(UBIN)/$(C_CMD) -F $(UBIN) "$(CMDS)"
$(INSCMD) -F $(ADMINHOME) "$(PARTS)"
# NOTE: this make file used to generate a partial passwd file, and the
# lines were to be included in the normal passwd file. However, SGI
# always includes these "sysadm" login names in the normal passwd file
# so there isn't any need to generate a partial one here
+142
View File
@@ -0,0 +1,142 @@
#ident "@(#)sadmin:admin/gettyvalues 2.4"
#ident "$Header: /proj/irix6.5.7m/isms/eoe/cmd/sadmin/admin/RCS/gettyvalues,v 1.4 1986/09/17 22:39:41 scott Exp $"
# Flag Values found in /etc/gettydefs
B0 Hang Up
B110 110 Baud
B1200 1200 Baud
B134 134 Baud
B150 150 Baud
B1800 1800 Baud
B2400 2400 Baud
B300 300 Baud
B4800 4800 Baud
B600 600 Baud
B75 75 Baud
B9600 9600 Baud
B19200 19200 Baud
BRKINT Signal Interrupt on Break
BS0 No Delay After Backspace
BS1 Short Delay After Backspace
BSDLY Select Backspace Delays
CBAUD
CDEL
CEOF cntl d
CERASE
CESC
CINTR DEL
CKILL
CLOCAL Local line
CNSWTCH
CNUL
CQUIT FS, cntl |
CR0 No Delay After Carriage-return
CR1 Short Delay After Carriage-return
CR2 Medium Delay After Carriage-return
CR3 Long Delay After Carriage-return
CRDLY Select Carriage-return Delay
CREAD Enable Receiver
CS5 5 Bit Character
CS6 6 Bit Character
CS7 7 Bit Character
CS8 8 Bit Character
CSIZE Character Size
CSTART cntl q
CSTOP cntl s
CSTOPB Send two stop bits
CSWTCH cntl z
ECHO Enable Echo
ECHOE Echo Erase Character as Backspace/Space/Backspace
ECHOK Echo New-line after Line Kill
ECHONL Echo New-line
EVENP Parity Enabled, 7 Bit Character
EXTA External A
EXTB External B
FF0 No Delay After Form-feed
FF1 Short Delay After Form-feed
FFDLY Select Form-feed Delays
HUPCL Hang Up on Last Close
ICANON Canonical Input (character erase and line kill processing)
ICRNL Map Carriage-return to New-line
IGNBRK Ignore Break
IGNCR Ignore Carriage-return
IGNPAR Ignore Characters with Parity Errors
INLCR Map New-line to Carriage-return
INPCK Enable Input Parity Check
IOCTYPE
ISIG Enable Signals
ISTRIP Strip Character
IUCLC Map Upper-case to Lower-case on Input
IXANY Enable Any Character to Restart Output
IXOFF Enable Start/Stop Input Control
IXON Enable Start/Stop Output Control
LDCHG
LDCLOSE
LDGETT
LDIOC
LDOPEN
LDSETT
LOBLK Block Layer Output
NCC
NL0 No Delay After New-line
NL1 Short Delay After New-line
NLDLY Select New-line Delays
NOFLSH Disable Flush after interrupt or quit
OCRNL Map Carriage-return To New-line On Output
ODDP Parity Enabled, 7 Bit Character, Odd Parity
OFDEL Fill is DEL Character
OFILL Use Fill Characters For Delay
OLCUC Map Lower Case To Upper Case On Output
ONLCR Map New-line To Carriage-return/New-line On Output
ONLRET New-line Performs Carriage-return Function
ONOCR No Carriage-return at Column 0
OPOST Postprocess Output
PARENB Parity Enabled
PARITY Parity Enabled, 7 Bit Character
PARMRK Mark Parity Errors
PARODD Odd Parity
SANE Set All Modes To "Traditionally Reasonable" Values
SSPEED Default speed: 300 baud
TAB0 No Delay After Horizontal-tab
TAB1 Short Delay After Horizontal-tab
TAB2 Long Delay After Horizontal-tab
TAB3 Expand Horizontal-tab To Spaces
TABDLY Select Horizontal-tab Delays
TCDSET
TCFLSH
TCGETA
TCSBRK
TCSETA
TCSETAF
TCSETAW
TCXONC
TERM_D40 TTY Mod 40/1
TERM_D42 TTY Mod 40/2B
TERM_H45 Hewlett-Packard 45
TERM_NONE tty
TERM_TEC TEC Scope
TERM_TEX Tektronix 4023
TERM_V10 DEC VT100
TERM_V61 DEC VT61
TIOC
TM_ANL auto newline on column 80
TM_CECHO echo terminal cursor control
TM_CINVIS do not send esc seq to user
TM_LCF last col of last row special
TM_NONE use default flags
TM_SET must be on to set/res flags
TM_SNL special newline flag
VEOF
VEOL
VEOL2
VERASE
VINTR
VKILL
VMIN
VQUIT
VSWTCH
VT0 No Delay After Vertical-tab
VT1 Short Delay After Vertical-tab
VTDLY Select Vertical-tab Delays
VTIME
XCASE Canonical Upper/Lower Case Presentation
+13
View File
@@ -0,0 +1,13 @@
#ident "@(#)sadmin:admin/menu/DESC 1.2"
#ident "$Header: /proj/irix6.5.7m/isms/eoe/cmd/sadmin/admin/menu/RCS/DESC,v 1.3 1986/09/17 22:33:37 scott Exp $"
# Description file for top menu of sysadm command.
#head# SYSTEM ADMINISTRATION
#menu# system administration menu
#help#
#help# System Administration routines help you setup and maintain the
#help# user's environment without having to use UNIX commands and
#help# command options. There is a short-hand way of accessing a System
#help# Administration menu or function. Each menu and function has a name.
#help# From the UNIX shell, you can access them by entering the command:
#help# sysadm "name"