Skip to content

Instantly share code, notes, and snippets.

@pixelchrome
Created April 18, 2021 10:02
Show Gist options
  • Save pixelchrome/db8ac00765f3d35b6d3921c2e0797ca4 to your computer and use it in GitHub Desktop.
Save pixelchrome/db8ac00765f3d35b6d3921c2e0797ca4 to your computer and use it in GitHub Desktop.
Single Node Rancher Docker Backup Scripts
#!/bin/sh
sudo rm /opt/rancher.bak/*
#!/bin/sh
docker stop rancher
sudo tar pzcf /opt/rancher.bak/backup_rancher_`date +%F`.tar.gz /opt/rancher
docker start rancher
@pixelchrome
Copy link
Author

I am using these scripts with backuppc as pre- and post-scripts

$Conf{BackupPCNightlyPeriod} = 1;
$Conf{RsyncShareName} = [
  '/opt/rancher.bak',
  '/home/ubuntu'
];
$Conf{XferMethod} = 'rsync';
$Conf{DumpPostUserCmd} = '$sshPath -q -x -l ubuntu $host /home/ubuntu/rancher_post_backup.sh';
$Conf{DumpPreUserCmd} = '$sshPath -q -x -l ubuntu $host /home/ubuntu/rancher_pre_backup.sh';
$Conf{RsyncSshArgs} = [
  '-e',
  '$sshPath -l ubuntu'
];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment