Starting External Processes
It is often necessary to start some process right before a backup session or just after it is completed. Usually such processes are used to make sure that the data are up-to-date or to free some space on a hard drive, to generate file descriptions, to prepare the data for recording to a CD-R etc.
nnBackup provides command line options wich allow to specify a process to run before (option -rb) or after (option -ra) the main backup process.
nnbackup.exe copy -i c:\data d:\backup\data -s -v -rb "d:\tools\index.exe -all" nnbackup.exe copy -i c:\data d:\backup\data -s -v -ra "d:\tools\clear.exe"
If necessary, you can run the required processes both before and after the main backup process:
nnbackup.exe copy -i c:\data d:\backup\data -s -v -rb "d:\tools\index.exe -all" -ra "d:\tools\clear.exe"
With options -dirb and-dira, you can specify a current directory:
nnbackup.exe copy -i c:\data d:\backup\data -s -v -rb "d:\tools\index.exe -all" -dirb c:\data nnbackup.exe copy -i c:\data d:\backup\data -s -v -ra "d:\tools\clear.exe" -dira c:\data
The following options can be used to process the possible errors:
-rps | - Run the application specified in -ra option only if the main process has been successfully completed |
-pbs | - Run the main process only if the error code returned by the application specified with -rb option is 0 |
If you frequently use outside processes, the command line may grow too long. In order to avoid this inconvenience, you can save command line parameters in a text file.
Example:
nnbackup.exe sync -i c:\data -o d:\backup\data -s -v -e -rb "d:\toos\wget.exe -N -r -l5 http://www.nncron.ru" -dirb c:\data -pbs
Explanation: onedirectional synchronisation of directories c:\data and d:\backup\data. During the synchronisation, nnBackup will take in account all subdirectories in c:\data and display/write to log the full file paths. Empty directories will be copied. Before synchronising, nnBackup will start an external process (wget.exe) and wait for its completion. C:\data is set as the current working directory for wget.exe. Synchronisation will be started only if wget.exe completed without any error.