Tool

aburgemeister's picture
tool
Reads:

8639

Score:
3.166665
3.2
6
 
Comments:

1

NDSRC

Author Info

22 March 2012 - 9:15am
Submitted by: aburgemeister

(View Disclaimer)

license: 
Free

This is a Perl-coded script designed to backup eDirectory on Linux or Solaris. eDirectory 8.7.x and 8.8 along with NICI 2.6.x and 2.7 currently work and are tested on Linux and Solaris. To run the script save it to a box with eDirectory on it and make the script executable. The script will automatically run with Perl when it is run directly. Perl comes, by default, on all Unix and Linux distributions. The script will run anywhere Perl is though it is not made to do anything properly on other platforms.

Update: 2012 Mar 22 - Fixes a couple of potential issues that have come up over the past couple years.

Update: 2007 Mar 03 - Now backs up vardir instead of dibdir only. For 8.8 it also backs up dibdir if it is not contained in vardir for large distributed-filesystem environments.

The script has a few options that can be passed in for scriptability without prompts. The info from ndsrc.pl -h follows:

Usage:

./ndsrc.pl -h   #Show help information. This info here.
./ndsrc.pl -p    /tmp/backup/path/goes/here
./ndsrc.pl -c  /etc/nds/conf/file/nds.conf[,/etc/other/conf/file/nds.conf]
./ndsrc.pl -d  /etc/opt/novell/eDirectory/conf/.edir/
./ndsrc.pl -s   #Force through the reminders that are defaults.

The -p option lets you specify where to put the destination TAR (Tape ARchive) files. This defaults to /root for security reasons. On Solaris you will want to create and secure this directory if it does not exist by default.

The -c option specifies a configuration (nds.conf) file specifically. This is useful for eDirectory 8.8 where multiple instances exist and need to be backed up in a scripted fashion (weekly backups of the entire DIB, for example).

The -d option specifies the directory where multiple configuration files exist. By default this is the /etc/opt/novell/eDirectory/conf/.edir/ directory. Having this configurable allows the script to be used for non-root installations of eDirectory. Non-root installations are installed all to one location, like a user's home directory.

The -s option skips through the first prompt telling the user that the DS instance that is backed up will be shutdown for the backup to be properly taken. Use this whenever the script is called from other scripts where interactivity is not an option. It can also be used to prevent one more check that may be annoying.

To run this script with eDirectory 8.8 be sure you have run the ndspath command. Without this the script will fail because it cannot find ndsmanage. This goes for eDirectory installed as root or non-root. As long as ndsmanage can be called without the absolute path the script will work.

The script has many lines of comments at the beginning regarding the scripts operation. Read these before using the script. Also you should try this out on your own and understand how things work before making this backup your DS nightly. Failing to do so could leave your DS stopped when it should have been restarted. The script performs no checks for adequate space and each backup is made to a new file so running this regularly will, eventually, fill your hard drive.

At the end of each run of the script a return value is sent back to the prompt for interpretation. A 0 means there were no fatal errors, a 1 means there was a fatal error. As other commands are made by the script the return values of those calls is included in the log which is output to the screen (via STDERR). That can be redirected to /dev/null (./ndsrc.pl -s 2>/dev/null) or it can be saved to a file for further analysis and interpretation (mail it to yourself, for example). The logging is fairly extensive and very helpful for troubleshooting.

The ability to backup other *nix's may come as I am able to find and test them (AIX is probably next). Comments/critiques/questions appreciated. The source is highly-commented and that is for the good of us all.

AttachmentSize
ndsrc.zip11.11 KB

Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.




User Comments

aburgemeister's picture

Note on extraction of an archive...

Submitted by aburgemeister on 12 September 2011 - 9:01am.

A customer noted that extracting the ndsrc-generated archive threw a nastygram when they used tar to extract as shown below:

# tar -xvf test-12\:34\:56.tar
test-12: Unknown host
tar: test-12\:34\:56.tar: Cannot open: Input/output error
tar: Error is not recoverable: exiting now
2011-09-12 09:59:00 Jobs:0 Err:2

The tar command has become smart over time and now appears to know how to chat on the network; as a result if it does not know you are explicitly pointing to a file and it sees a colon (:) in the file name it tries to find something on the network. The default filename created by ndsrc.pl includes colons to show the time of the backup taken for both eDir and NICI and so if you try to use tar as shown above to extract the archive it will fail (for versions of tar that understand colons may be delimiters for hosts). The workaround for this is to just add a dot-slash before the file:

# tar -xvf ./test-12\:34\:56.tar

This tells 'tar' that this is a file where you are.... an absolute path should work as well of course... and therefore tar doesn't try to do anything network-related.

© 2013 Novell