[sourcecode language="css" wraplines="false" collapse="false"]
]
#!/bin/bash
###################################
# This script makes a tar of the moodledata
[/sourcecode]
[sourcecode language="bash"][/sourcecode]
#!/bin/bash
###################################
# This script makes a tar of the moodledata
# backup and then uses rsycn to backup
# the working moodledata copy in the
# moodle instance server.
###################################
BACKUP_DEST="/home/mkepadilla/test/"
BACKUP_DIR="backup/"
BACKUP_HOST="10.11.4.158"
BACKUP_USER="mkepadilla"
BACKUP_PASS="MDSc.45p"
SRC_DIR="dummy_moodle_data/"
SRC_PATH="/var/www/"
#SRC_HOST="10.11.4.119"
#SRC_USER="ps_web"
SRC_PASS="MDSc.45p"
# compress the backup in the remote server
ssh $BACKUP_USER@$BACKUP_HOST tar -Pzcvf backup$(date +"%m%d%Y%H%M%S").tar.gz $BACKUP_DEST$BACKUP_DIR
# Check if successful: 0 - no error
if [[ $? -eq 0 ]]
then
# Update your backup with the changes
rsync -auvtz --delete -e ssh $SRC_PATH$SRC_DIR $BACKUP_USER@$BACKUP_HOST:$BACKUP_DEST$BACKUP_DIR
if [[ $? -eq 0 ]]
then
echo "DONE. Status OK."
else
echo "Backup was not performed. rsync command failed." | mail -s "Daily backup failed." mkpadilla@chikka.com
exit 1
fi
else
echo -e "Backup was not performed. tar command failed." | mail -s "Daily backup failed." mkpadilla@chikka.com
fi
# end
[sourcecode][/sourcecode]
fhdfhdhdf
No comments:
Post a Comment