Novell Home

Automating DIB Collection

Novell Cool Solutions: Feature
By Thomas Erickson

Digg This - Slashdot This

Posted: 15 Feb 2006
 

Introduction

Do you need a way to automate the taking and collecting of eDirectory/ds Database Information Base (DIBs)? If so, I think you will be excited about this solution! A friend of mine who would like to remain anonymous wrote this for his environment. He and I feel we should give back to the community and help others. I'm his proxy in sharing this with you.

Novell support strongly recommends taking regular DIBs, especially before doing ANY DS operation (add/delete replica, merge, etc). When possible, replace human labor with computer automation. My friend's environment has about 45 locations with many servers that need daily DIBs taken.

Installation

Here are the steps to follow to use this solution:

  1. Unzip Thomas DibSet.zip and copy the system directory to the sys:\system on every server. You can automate this with Onsite Admin Pro or rragent.nlm, version 2.
  2. Copy the etc directory to the sys:\etc directory of every server you want this installed on. crontab is the preferred scheduling tool, as it will exit the Perl engine when it is complete.
  3. Put cron.nlm in the autoexec.ncf and load it on the console.
  4. Run bkupds.pl on the console. This will create a bkupds.ncf file with that server's specific info in it.

Modification

It is very likely you will need to modify the script for your environment(s). Please look for the bold font for where you will need to modify the script.

bkupds.pl

#! /usr/local/bin/perl
# bkupds.pl - dsrepair dibset backup
# 
# 
###
# DOCUMENTATION:
# This program will dynamically create a NCF file to do the following:
# The dibsets are store in following format:
#  1.  Perform DSRepair -RC
#  2.  Delete previous weeks sys:dibset\<day of week>\*.*
#  3.  Copy dibset to sys:dibset\<day of week>
#  4.  Zip  sys:dibset\<day of week>\<server8char>.zip
#  5.  Copy sys:dibset\<day of week>\<server8char>.zip 
\\<backupserver>\<vol1>\dibsets\<day of week>\<server8char>
#
# The program will then submit the ncf to the console and exit.
# 
# The program is loaded by cron command: perl bkupds.pl --autodestroy
###
#  Logic Flow:
#  1. Get Server Name from autoexec.ncf
#  1a.  Limit server name to 8 characters
#  2. Determine the day of the week.
#  3. Build NCF file.
#  4. Execute NCF file.
#  5. Exit Perl
###
#  Get Server Name
###
    open AUTO, "sys:/system/autoexec.ncf";
    while () {
        if (/^file server name/i) {
            $myline = $_;
            chomp($myline);
            $serv_nm = substr($myline,17);
        }
    }
    close AUTO;
	
    #  If server name is larger that 8 characters you need to create 
    #  a shorter server name.  The default is to use the server name.
    if ($serv_nm eq "xxx-DIS-999") {$servshort_nm = "xxdis999";} 
    elsif ($serv_nm eq "xxx-WEBxxx") {$servshort_nm = "xxxwebxx";} 
    elsif ($serv_nm eq "xxxx-xxxxx-VM") {$servshort_nm = "xxxxvm";} 
    else {$servshort_nm = $serv_nm;}
###
#  End Get Server Name
###
###
#  Get day of week
###
    $now = scalar localtime(time);
    $day = substr($now,0,3);
###
# end date routine
###
###
#  Create BKUPDS.NCF
###
    open NCFFILE, ">sys:bkupds.ncf";
    print NCFFILE "#This ncf file was created by bkupds.pl perl script.\n\n";
    print NCFFILE "\n#3. Perform dsrepair\n";
    print NCFFILE "dsrepair -rc\n\n";
    print NCFFILE "\n#4. Delete previous weeks dibset in local backup folder\n";
    print NCFFILE "del $serv_nm/sys:/dibsets/$day/*.* -y\n";
    print NCFFILE "\n#5. Delay 5 minutes to let DSREPAIR finish\n";
    print NCFFILE "delay 300\n";
    print NCFFILE "\n#6. Copy dibset to working folder\n";
    print NCFFILE "copy $serv_nm/sys:system/dsr_dib/*.* sys:/dibsets/$day\n";
    print NCFFILE "\n#7. Delay 1 minute to let copy complete\n";
    print NCFFILE "delay 60\n";
    print NCFFILE "\n#8. Zip new dibset\n";
    print NCFFILE "load myzip -w\$ sys: \\dibsets\\$day
\\$servshort_nm.zip \\dibsets\\$day\\*.*\n";
    print NCFFILE "\n#9. Copy dibset to offsite server.\n";
    print NCFFILE "delay 30\n";
    print NCFFILE "copy $serv_nm/sys:dibsets/$day/*.zip 
NovellRocks-Fs1/UTtechs2:dibsets/$day\n\n";
    close NCFFILE;
###
#  End create BKUPDS.NCF 
###
#  Submit BKUPDS.NCF file
    system("sys:bkupds.ncf ");
# end bkupds.pl

Conclusion

Have fun with this solution, and remember to give back to the community!


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell