Skip to content

Instantly share code, notes, and snippets.

@akrzos
Created June 1, 2015 20:17
Show Gist options
  • Save akrzos/91ebf668c3039b57992a to your computer and use it in GitHub Desktop.
Save akrzos/91ebf668c3039b57992a to your computer and use it in GitHub Desktop.
Create satellite 6.1 backup with synced content
export BDIR=/home/backup/(create name of "backup" here)
mkdir -p $BDIR
chmod 770 $BDIR
chgrp postgres $BDIR
cd $BDIR
katello-service stop
service foreman-proxy stop
sync; sync; echo 3 > /proc/sys/vm/drop_caches
tar --selinux -cvf pulp_data.tar /var/lib/pulp /var/www/pub
service mongod start
sleep 5
mongodump --host localhost --out $BDIR/mongo_dump
service mongod stop
service postgresql stop
sync; sync; echo 3 > /proc/sys/vm/drop_caches
service postgresql start
su postgres -c "pg_dump -Fc candlepin > $BDIR/candlepin.dump"
su postgres -c "pg_dump -Fc foreman > $BDIR/foreman.dump"
su postgres -c "pg_dump -Fc gutterball > $BDIR/gutterball.dump"
df -h >> $BDIR/df-h
df >> $BDIR/df
service foreman-proxy start
katello-service start
cd ~
hammer -u admin -p changeme ping
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment