#!/bin/bash
## Database Backup Script - Embedded Only
prettyDATE=`date +%F`
BACKUPS=/var/satellite/backups
BACKUPDIR=${BACKUPS}/${prettyDATE}
DBBACKUPDIR=${BACKUPS}/${prettyDATE}/DB
mkdir -p ${BACKUPDIR}
mkdir -p ${DBBACKUPDIR}
chown oracle:dba ${DBBACKUPDIR}
/usr/sbin/rhn-satellite stop
echo "-- `date`"
tar -cvf ${BACKUPDIR}/var_lib_rhn_kickstarts_upload.tar /var/lib/rhn/kickstarts/upload/
tar -cvf ${BACKUPDIR}/var_lib_cobbler.tar /var/lib/cobbler/
tar -cvf ${BACKUPDIR}/etc_cobbler.tar /etc/cobbler/
tar -cvf ${BACKUPDIR}/etc_rhn.tar /etc/rhn/
su - oracle -c "db-control backup ${DBBACKUPDIR}"
echo "-- `date`"
/usr/sbin/rhn-satellite start
echo "-- `date`"
su - oracle -c "db-control verify ${DBBACKUPDIR}"
echo "-- `date`"
# TRAVERSE THE BACKUP DIR TO DELETE OLD(ER) BACKUP FILES
# I DO NOT LIKE USING A VARIABLE FOR THE PATH FOR THIS TYPE OF COMMAND
find /var/satellite/backups -type d -mtime +14 -exec rm -rf {} \;
/usr/sbin/rhn-satellite status
## Database Backup Script - Embedded Only
prettyDATE=`date +%F`
BACKUPS=/var/satellite/backups
BACKUPDIR=${BACKUPS}/${prettyDATE}
DBBACKUPDIR=${BACKUPS}/${prettyDATE}/DB
mkdir -p ${BACKUPDIR}
mkdir -p ${DBBACKUPDIR}
chown oracle:dba ${DBBACKUPDIR}
/usr/sbin/rhn-satellite stop
echo "-- `date`"
tar -cvf ${BACKUPDIR}/var_lib_rhn_kickstarts_upload.tar /var/lib/rhn/kickstarts/upload/
tar -cvf ${BACKUPDIR}/var_lib_cobbler.tar /var/lib/cobbler/
tar -cvf ${BACKUPDIR}/etc_cobbler.tar /etc/cobbler/
tar -cvf ${BACKUPDIR}/etc_rhn.tar /etc/rhn/
su - oracle -c "db-control backup ${DBBACKUPDIR}"
echo "-- `date`"
/usr/sbin/rhn-satellite start
echo "-- `date`"
su - oracle -c "db-control verify ${DBBACKUPDIR}"
echo "-- `date`"
# TRAVERSE THE BACKUP DIR TO DELETE OLD(ER) BACKUP FILES
# I DO NOT LIKE USING A VARIABLE FOR THE PATH FOR THIS TYPE OF COMMAND
find /var/satellite/backups -type d -mtime +14 -exec rm -rf {} \;
/usr/sbin/rhn-satellite status
Comments
Post a Comment