Linux Training

Linux training for private, public & voluntary sector.

0793 572 8612

City LinUX sample scripts - ftchbkup


ftchbkup - fetches backups from remote host to a local repository.


ftchbkup [ -c <config> ] [ -d ] [ -l ][ -v ] < hostname >


ftchbkup is a Bourne shell script which should work equally well on all versions of UNIX, Linux and Mac OS X.


ftchbkup uses the configuration file ( /usr/local/etc/ by default) to determine the location and age of the backup files to fetched from the remote host and the path to the local repository. The archives are fetched using lftp .

In order to save disk space in the local repository, archives older than the maximum age set in configuration file are deleted once the the latest files have been successfully downloaded.


-c    <config_file> Use the named configuration file in preference to the default /usr/local/etc/ .

-d    Start in debug mode. The script will run in a shell with the -x    option set.

-l    Log each backup field retrieved from the target host using the syslog facility.

-v    Set verbose mode. Ordinarily ftchbkup operates silently unless problems are detected. In verbose mode ftchbkup reports on each significant action.


ftchbkup -v caswallon-gw

Using the hostname " caswallon-gw " as the lookup key, ftchbkup will extract the details of the backup files to be fetched from the default configuration file /usr/local/etc/ , and fetch them from the remote server to the local repository.


The script is quite crude having been developed to fetch archives from client servers hosted by 1and1. The use of the configuration file does however make it reasonably generic. File permissions are critical and sudo will be used within the script to execute the find command. With judicious use of the debug and verbose modes, permission and configuration problems should be relatively easy to resolve.





Clifford W Fulford, City Linux. Contact or +44 (0)709 229 5385.

The layout and associated style sheets for this page are taken from the World Wide Web Consortium and used here under the W3C software licence.