#!/bin/bash
DATE=`date +%Y%m%d.%H%M`
HOST=`sh1`
TEMP=/mnt/backup
echo "Preparing backup..."
cd /etc
tar cf - ./* |bzip2 -9 - >$TEMP/$HOST-etc.$DATE.tar.bz2
cd /var/bind
tar cf - ./* |bzip2 -9 - >$TEMP/$HOST-bind.$DATE.tar.bz2
cd /var/yp
tar cf - ./* |bzip2 -9 - >$TEMP/$HOST-nis.$DATE.tar.bz2
cd /var/ldap
tar cf - ./* |bzip2 -9 - >$TEMP/$HOST-ldap.$DATE.tar.bz2
echo "complete backup..."
|
# cd /mnt/backup
# tar –jmxvf sh1-etc.date.tar.bz2 –C /etc/ # tar –jmxvf sh1-bind.date.tar.bz2 –C /var/bind/
# tar –jmxvf sh1-nis.date.tar.bz2 –C /var/yp/
# tar –jmxvf sh1-ldap.date.tar.bz2 –C /var/ldap/ |
# ypinit –m
In order for
the
of preference, one per line. When you are done with the list, type a
<control D> or a return on a line by itself.
next host to add: sh1
next host to add: ^D
The current list of yp servers looks like this:
sh1
Is this correct? [y/n: y] y
Installing the YP database will require that you answer a few questions.
Questions will all be asked at the beginning of the procedure.
Do you want this procedure to quit on non-fatal errors? [y/n: n] n
OK, please remember to go back and redo manually whatever fails. If you
don't, some part of the system (perhaps the yp itself) won't work.
# /usr/lib/netsvc/yp/ypstart
# cd /var/yp; /usr/ccs/bin/make
# /etc/init.d/autofs start |
#!/bin/bash
WORKDIR=/u/sysadmin/backup/sh1
LOGFILE=${WORKDIR}/log/`date +%Y%m%d`.log
UFSDUMP=/usr/sbin/ufsdump
UFSRESTORE=/usr/sbin/ufsrestore
exec > $LOGFILE 2>&1
mount -F ufs /dev/dsk/c0t1d0s0 /backup/root
mount -F ufs /dev/dsk/c0t1d0s3 /backup/home
$UFSDUMP
$UFSDUMP
umount /backup/root
umount /backup/home
fsck -y /dev/rdsk/c0t1d0s0
fsck -y /dev/rdsk/c0t1d0s3
installboot /usr/platform/sun4u/lib/fs/ufs/bootblk /dev/rdsk/c0t1d0s0
exit |