KBackup can be extended by using a shell script (or any other executable) which will be started at three different points during the backup process. The idea behind it is to allow to mount, unmount, eject media in a system specific way, or do other things with the produced archive files.
The script to execute must be given with the
--script command line option.
Here is a sample script:
Example 4.1. sliceScript.sh
#!/bin/sh mode=$1 archive=$2 target=$3 mountPoint=$4 case "$mode" in "slice_init" ) if [ "$mountPoint" != "" ] then mount /media/zip rm -f /media/zip/backup_2*.tar* fi ;; "slice_closed" ) ;; "slice_finished" ) if [ "$mountPoint" != "" ] then umount /media/zip eject /media/zip fi ;; esac
The script is always invoked with four command line arguments:
archive (slice) file name
mountpoint of the target directory if it's a local directory, else an empty string
There are three possible invocation modes:
called before a new archive slice is being created on disc
called after an archive slice has been created, but before it has been put into the target directory
This can be used if you want to copy the archive slice to some additional place, e.g. the archive is sent to the main server (via a target URL), but you want to keep the last backup also onto the local disc.
called after an archive slice has been successfully transferred into the target directory