Having had to use it now, perhaps the only other thing I would add into it would be the root crontab, but that would simply be:
crontab -l >> $log
Obviously, < server > is your server name, i.e. atuin or sunsvr01. And the < off server storage location > is a storage location that is easily accessible when you need it!
# more scripts/nisbackup.sh
#!/bin/sh
log="/var/tmp/nisbackup.log"
date=`date '+%m/%d/%y at %H:%M:%S'`
echo "Starting NIS+ backup on $date" > $log
cp -p /etc/.rootkey /var/nisplus.rootkey.copy
cp -p /var/nis/NIS_COLD_START /var/<server>-NIS_COLD_START
cp -p /etc/shadow /var/<server>-shadow
cp -p /etc/passwd /var/<server>-passwd
/usr/sbin/nisbackup -a /var/nisplus_backup
if [ $? -eq 0 ]; then
cd /var
echo "Listing nisplus_backup" >> $log
ls -l /var/nisplus_backup >> $log
echo "Creating tar" >> $log
tar cvf /<off server storage location>/nisplus/backup/
echo "Checking validity of tar:" >> $log
tar tvf /apps/admin/nisplus/backup/
else
echo "nisbackup failed!!!" >> $log
fi
/usr/bin/mailx -s "NIS+ backup" server_admins < $log
#
No comments:
Post a Comment