maxdome
Chevereto Member
Many years ago I had scheduled a solution to make backups of the websites from my customers.
Step by Step this script was improving until generate backups of the website and the database.
The last creation was that once made the backup, it send an email to the customer with info that the backup was generated.
This Script it makes a complete backup of your Chevereto website with database, also if you want transfer it to another hosting.
I share my work with pleasure to help the "Chevereto Users" who need it.
Unfortunately this script runs under linux with root or user access.
--------------------------------------------------------------------------------------------------------------------------------
Before doing the steps you need to change some details of the script.
Step-1: Create the file: touch backup.chevereto.sh wherever you want.
Step-2: Give run permissions: chmod +x backup.chevereto.sh
Step-3: Edit the file: vim backup.chevereto.sh
Step-4: Copy the Backup Script below and paste into the backup.chevereto.sh
Step-5: Save changes and exit from backup.chevereto.sh
Step-6: Create a folder with the name backups e.g. /home/backups
Change some details of the script:
Step-7: Now Run the bash script ./backup.chevereto.sh
-----------------------------------------------------------------------------------------------------------------------
That is all
DEMO :
Script:
FTP:
Email:
Good Luck
If you liked my script, please click the "like" button
Best Regards:
Gio
Step by Step this script was improving until generate backups of the website and the database.
The last creation was that once made the backup, it send an email to the customer with info that the backup was generated.
This Script it makes a complete backup of your Chevereto website with database, also if you want transfer it to another hosting.
I share my work with pleasure to help the "Chevereto Users" who need it.
Unfortunately this script runs under linux with root or user access.
--------------------------------------------------------------------------------------------------------------------------------
Before doing the steps you need to change some details of the script.
Step-1: Create the file: touch backup.chevereto.sh wherever you want.
Step-2: Give run permissions: chmod +x backup.chevereto.sh
Step-3: Edit the file: vim backup.chevereto.sh
Step-4: Copy the Backup Script below and paste into the backup.chevereto.sh
Step-5: Save changes and exit from backup.chevereto.sh
Step-6: Create a folder with the name backups e.g. /home/backups
Change some details of the script:
Code:
#!/bin/bash
#Backup Manager Script v1.5
#Created on 13-09-2013
#Update on 27-04-2015
#Author = Maxdome
#Web = Sabox.de
##############CLIENT ->
DOMAIN="mydomain.com" # Put The Domain Name - without http:// and WWW
CHOWND="user" # Put the user ownership
CHOWNE="group" # Put the group ownership
MAILTO=customer@domain.com # Put the customer Email
MYSQLUSER=username # Put the MySQL Username
PASSWORD=password # Put the MySQL Password
DBNAME=database # Put the MySQL Database Name
##############<- CLIENT
SENDER=backups@mydomain.com # Put the owner Email
MYSQLHOST=localhost # Put the MySQL hostname by default is (localhost)
DESDIR="/home/backups" # Put the destination folder backup
TIME=`date +"%d.%m.%y"`
NOW=`date +"%s"`
echo ""
echo "Start Manager Backup - $DOMAIN"
echo "------------------------------"
##############BACKUP_MYSQL ->
FILESQL="backup-$TIME.MYSQL.$NOW.tar.gz"
BACKUPSQL="$DESDIR/backup-$TIME.MYSQL.$NOW.sql"
mysqldump -h$MYSQLHOST -u$MYSQLUSER -p$PASSWORD $DBNAME > $BACKUPSQL
tar -czPf $DESDIR/$FILESQL $BACKUPSQL
chmod 775 $DESDIR/$FILESQL
chown $CHOWND:$CHOWNE $DESDIR/$FILESQL
rm $BACKUPSQL
echo "- MYSQL File Backup has been created successfully."
###############<- BACKUP_MYSQL
###############BACKUP_WEB ->
FILENAME="backup-$TIME.WEB.$NOW.tar.gz"
SRCDIR="/var/www/$DOMAIN" # Put the folder you need to make backup. The ($DOMAIN) is your Cheverote Web
tar -czPf $DESDIR/$FILENAME $SRCDIR
BACKUPPATH="$DESDIR/backup-$TIME.WEB.$NOW.tar.gz"
chmod 775 $DESDIR/$FILENAME
chown $CHOWND:$CHOWNE $DESDIR/$FILENAME
echo "- WEB File Backup has been created successfully."
###############<- BACKUP_WEB
# This script send an email to the customer to inform the backup is generated.
# You can change the text and put whatever you like.
if [ ! -f $BACKUPPATH ]; then
echo -e "File not found!" | mail -s "backup failed" -r $SENDER $MAILTO
else
echo -e "New Backup Generated.
\nBackup files:
\n1) $FILENAME\n2) $FILESQL\n
\nPlease download the new backup files from your FTP and keep it in a safe place.
\nConnect from the FTP client to Hosting.\nNavigate to the path where the default backups files are hosted, by default is: /backups\nDownload the new backup files and delete it from your Hosting.
\nNote: This type of discharge is recommended for large files, because if you lose connection, the FTP application resume at the same point where the download was.
\nIf you have any problems please contact us.
\nBest Regards:
\nMyName\nBackups Manager\nmy@domain.com
\nMy Company\nHauptsitz: Street 1, 10700 City\nTel: (015) 012 052 052 \nFax: (015) 012 052 053 \nmy@domain.com \nwww.mydomain.com " | mail -s "New Backup Generated" -r $SENDER $MAILTO
fi
echo "----------------------"
echo "Done"
#END
Step-7: Now Run the bash script ./backup.chevereto.sh
-----------------------------------------------------------------------------------------------------------------------
That is all
DEMO :
Script:
FTP:
Email:
Good Luck
If you liked my script, please click the "like" button
Best Regards:
Gio
Last edited: