User Tools

Site Tools


Backing Up and Restoring Zibawa

Backup User

All backups are carried out by the user “zibawa”

Backup directory

The zibawa user must have access to write to the back up directories as defined in the scripts.


Backup scripts

Are found in ..zibawa/bin/

The scripts should work “as is” if standard path locations have been used as in the documentation.

Postgres Database

Standard postgres backup scripts are provided in the zibawa/bin/backup_scripts directory which were copied above. To run these scripts do the following:

Setup Postgres User Password

The postgres user by default comes with no password. Setup a password for that user in POSTGRES (not UNIX) as follows:

sudo -u postgres psql postgres
# \password postgres

Enter new password: 

To enable password free backups it is necessary to include a file .pgpass in zibawabackup users home directory. The scripts do a complete backup of the postgres system and so need to run as the postgres user.

sudo nano /home/zibawa/.pgpass

hostname:port:database:username:password For example

localhost:5432:*:postgres:<password created above>

* denotes all databases


The backup user directory has the following permissions

all other700
sudo chmod 0600 /home/zibawa/.pgpass
sudo chown zibawa /home/zibawa/.pgpass
sudo chmod +x -R /home/zibawa/zibawa/bin

Test the backup script

Run the script as zibawa user

sudo -u zibawa /home/zibawa/zibawa/bin/backup_scripts/

The script should run without prompting for passwords, and produce a set of backups in the specified directory.

Include the backup scripts in backupuser crontab

The postgres script must be in the backup user crontab. (in order to access the password we defined above)

sudo crontab -e -u zibawa

55 10 * * * /home/zibawa/zibawa/bin/backup_scripts/ 1> /var/log/zibawa/pg_backup_rotated.log 2> /var/log/zibawa/pg_backup_rotated.err

The LDAP and influx scripts are run by root

sudo crontab -e

00 02 * * * /home/zibawa/zibawa/bin/backup_scripts/ 1> /var/log/zibawa/influxDB_backup_daily_24h.log 2> /var/log/zibawa/influxDB_backup_daily_24h.err

55 02 * * * /home/zibawa/zibawa/bin/backup_scripts/ 1> /var/log/zibawa/ldap_backup.log 2> /var/log/zibawa/ldap_backup.err

30 02 * * * /home/zibawa/zibawa/bin/backup_scripts/ 1> /var/log/zibawa/conf_backup.log 2> /var/log/zibawa/conf_backup.err


influx backup and restore documentation

No password is required. It is possible to backup by time period which although not strictly incremental, is probably close enough.

influxd restore -database dab50 -datadir /var/lib/influxdb/data /tmp/backup

LDAP Backup

The following file is in zibawa/backup_scripts



nice ${SLAPCAT} -n 0 > ${BACKUP_PATH}/config.ldif
nice ${SLAPCAT} -n 1 > ${BACKUP_PATH}/

chmod 640 ${BACKUP_PATH}/*.ldif


Problems may be caused by file permissions when copying files. Make sure all files and directories are owned by the backup user.

adm/backing_up_and_restoring_zibawa.txt · Last modified: 2017/03/28 09:41 by matt