View Single Post
Old 10-06-2016, 03:45 PM  
Kafka
Confirmed User
 
Kafka's Avatar
 
Join Date: Oct 2002
Location: Holland
Posts: 466
Quote:
Originally Posted by robwod View Post
Yes, a simple bash script. In a simple text editor, a person could enter the following and save it as backups.sh

Code:
# ##########################################################
# DUMP DATABASE(S)
# ##########################################################

mysqldump --user=root --password='whatever' --host=localhost databasename > databasename.sql

# ##########################################################
# TAR WEBSITE(S)
# ##########################################################

tar -cpf domainname.tar /path/to/domainname.com

# ##########################################################
# MOVE FILES TO BACKUP FOLDER
# ##########################################################

mv databasename.sql /path/to/backups/
mv domainnanme.tar /path/to/backups/
You could of course, dump/tar and move at one time, but this just explains it relatively easy.

All one needs to do then is to add a cron job to execute backups.sh nightly.

Code:
0 0 * * * /bin/bash /path/to/backups.sh > /dev/null
That's it, now your databases and all files for the specified domain are backed up every night at midnight. If you want to store them on a separate server, rsync will let you connect to any of your other hosts and you can transfer them in similar fashion, through a simple bash script and a cronjob.

And these command line instructions remove any dependency on a third party plugin and are included with any basic *nix server.
The user should not be root but the user who is admin of that particular database.
Kafka is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote