Linux Training

Linux training for private, public & voluntary sector.

0800 024 8425

City LinUX sample scripts - plbkup


plbkup - creates a full system backup on a remote host and moves it to an ftp repository.


plbkup [ -c <config_file> ] [ -d ] [ -e <e-mail_rcpt> ] [ -l ] [ -n <encryption_tool> ] [ -p <remote_psa_config> ] [ -t <type> ] [ -T ] [ -v ] <hostid>


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


The script plbkup invokes a ssh session to a remote host identified by hostid (which must be specified on the command line) and runs the pleskbackup command to create a full system backup. The resultant tar file is compressed with gzip and encrypted with gpg before being transferred using lftp to an ftp repository. Lftp is used rather than the built in ftp transfer agent in pleskbackup for no better reason than that it works, whereas, for me at least, the latter does not.

The hostid may be a host name but I have found it far easier in this age of one way DNS lookups, long generic service provider canonical hostnames et al, to use a short host id that can be used in lookup tables and mapped in host files or the local DNS (where there is a split horizon).

The script is most useful when invoked by cron.


-c    <config_file> The default configuration file is /usr/local/etc/ An alternative file may be set with the -c option.

-d    Set debug mode on.

-e <e-mail_rcpt> Notifications and alerts will be sent to the mail address specified at e-mail_recipient. If the -e    option is not used plbkup will attempt to send the email alert to the user invoking the command on the local host.

-l    Use the syslog logging facility to record the use of plbkup and it's success or failure.

-n <encryption_tool> Encrypt the archive before transfering to the ftp repository using the specified encryption tool.

-p <remote psa configuration file> plbkup graps a copy of the current psa configuration file from the remote host and processes it locally each time the command is run.

-t <type>
The default backup type is a full plesk server backup, other backup types (objects) can be specified on the command line. See pleskbackup documentation).

-T    Puts the script in test mode. Access and availabilty of all the components is checked but the actual backup, which might take several hours, is assumed to have completed successfully without actually having been built.

-v    Set the operation mode of the script to verbose. In verbose mode plbkup will report it's progress as it runs and will write any alerts to standard out .


plbkup -l -e fcl 

Create a full backup of fcl 's host (Fulford Consulting Ltd) and transfer it to the associated ftp repository. Use the local syslog facility to log the command and it's success or failure.

Send notifications and alerts to

plbkup -v cwit

Create a full backup of the host associated with "City Windows IT" ( cwit ) and transfer the resulting file to the associated ftp repository. Use verbose mode and report significant actions to standard out. send alerts by email to the current user's local e-mail address.

Notifications and alerts will be emailed to the user on the local host.


The script has very little input error checking. Network availability is not checked prior to invoking ssh commands. The script is designed to be used with frequently used hosts where ssh keys have already been exchanged.


/usr/local/etc/ , /tmp/psaconf.$$ - a local copy of the remote psa.conf. Normally removed on completion, if the script fails the file will remain on the local system.


ftchbkup, rclean.


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.