Copy Gitlab backup files to an external disk by configuring crontab

2

I configured the server to run a cronjob and run the script that backs up Gitlab.

Gitlab in turn generates the .tar files in the var/opt/gitlab/backups

The first problem is that to access the above mentioned folder, I have to access it using sudo -i .

The second is that I need to configure the crontab to synchronize the files from the var/opt/gitlab/backups folder to the external /media/<user>/usbbackup/ disk.

How do I configure crontab to perform the action described above?

    
asked by anonymous 22.09.2016 / 11:39

1 answer

2

You can add && rsync -a /var/opt/gitlab/backups/ /media/<user>/usbbackup to the backup command in crontab. That way, when the backup is finished, the copy will be made. Make sure that the user running the command in crontab has read and write permissions on the directory.

You can also backup directly to the desired directory by adding the gitlab_rails['backup_path'] = '/media/<user>/usbbackup/' option to the gitlab /etc/gitlab/gitlab.rb configuration file. Remember to execute gitlab-ctl reconfigure after the change.

    
22.09.2016 / 14:34