Primary Purpose#
This script does a Backup image of eDirectory DIB temporarily closing database making LDAP and eDirectory in a downed condidtion.Deployed Location#
The LDAPBuild Process distribute the <buildhome>Directory-Info.com/config/ndsbackup.sh file to /usr/bin/ndsbackup.shMethod of Execution #
The script is run via cron.tabLogging#
The script creates a log file /var/nds/ndsbackup.logOther Notable Features#
The script creates a zipped files of DIB and related files for Disaster Recovery at: /var/nds/$bkupDIR.Archive files located in $bkupDIR older than MTIME this are deleted
Watch out for These Items#
Backup image of eDirectory DIB -- temporarily closes databaseMust be run with root privilages.
Typical script content as implemented is shown below.
#!/bin/bash
#:ndsbackup.sh
#
# There is no error checking, files will be overwritten, variables
# may be unassigned, ... Caveat Hackor
#
# Modification history:
# 12/03/2003--Moved functions to ndsenv_functions
# 1/20/2004 --If running as root, create $bkupDIR if it isn't already
# there
# Remove f_write_and_log commands from here, add to functions
#
# Read eDirectory installation variables and subroutines
if [ -f /var/nds/.ndsenv ]
then
. /var/nds/.ndsenv_functions
. /var/nds/.ndsenv
else
printf "\nMissing /var/nds/.ndsenv -- cannot run!\n"
exit 1
fi
EMAIL_BODY=/tmp/tmp.ndsbackup.$$ # Temp file to hold email message
##############################################################
# Override ndsenv variables
##############################################################
# The following variables should be set in /var/nds/.ndsenv; if these aren't set
# for some reason, initialize them to some good default values
PATH=$PATH:/usr/local/bin
export PATH
# User to change ownership of archive files
USER=ndsuser
# Archive files located in $bkupDIR older than this are deleted
MTIME=${MTIME:=7}
# If running as root, create $bkupDIR if it isn't already there
f_checkroot
if [ ! -d $bkupDIR ] && [ $? -eq 0 ]
then
f_cmd mkdir $bkupDIR
f_cmd chown $ndsUSER $bkupDIR
f_cmd chgrp $ndsGROUP $bkupDIR
fi
# Read command line parameter into a variable
Param=`echo $1|tr "[:lower:]" "[:upper:]"`
f_backupnds $Param