VMware Cloud Community
moellerjot
Enthusiast
Enthusiast

Custom cronjob for vCD db-backup with vCD 10.3+ changes

Issue: New database backuptool in newer vCD Version 10.3+  -> /opt/vmware/appliance/bin/create-backup.sh

Custom Solution: 

# root cronjob usage on all Cells

 

0 7,19 * * * /opt/vmware/vcloud-director/data/transfer/mybackup.sh > /dev/null 2>&1

 

/opt/vmware/vcloud-director/data/transfer/mybackup.sh # location of transfert share

 

#!/bin/bash
#############################################
### vCD Backup Database 10.3+ by moellerj ###
#############################################
myhostname=`hostname|cut -d "." -f1` # if fqdn
# ident primary Cell
   getmaster=`sudo -i -u postgres /opt/vmware/vpostgres/current/bin/repmgr -f /opt/vmware/vpostgres/current/etc/repmgr.conf cluster show|grep "*" |cut -d "|" -f 2`

# If primary Cell exec 
if  [ $myhostname = $getmaster ] ; then
   /opt/vmware/appliance/bin/create-backup.sh
fi

 

somethingofnotsupported
# no backup no pity
# Copyleft

Labels (4)
Tags (2)
Reply
0 Kudos
1 Reply
imthiachulu
Contributor
Contributor

I have written a similar script that gives you the advantage of giving a retention policy to delete the old backups.


https://imthiyaz.cloud/how-to-schedule-automatic-backup-for-vmware-cloud-director

https://github.com/imthiachulu/vcd-automatic-backup

Thank You

Imthiyaz Cloud
Tags (2)
Reply
0 Kudos