Note: You are currently viewing documentation for Moodle 3.1. Up-to-date documentation for the latest stable version of Moodle is probably available here: Tools for backing up server files.

Tools for backing up server files

From MoodleDocs

There are many ways to back up server files that contain Moodle code and moodledata. Site Backup for Low-tech Users also has information on this subject.

Rsync in linux

For the files, you can use rsync regularly to copy only the changed files to another host:

rsync -auvtz --delete -e ssh mysshusername@example.com:/my/server/directory /my/backup/directory/

If you want to run the cronscript at the machine you are running Moodle at you have to use following rsync syntax

rsync -auvtz --delete -e ssh /path/to/local/folder/ remoteuser@remoteserver:/path/to/remote/folder/

If you do not want the root mailbox be spammed by statusmails of the rsync use:

 rsync -autzq --delete -e ssh /path/to/local/folder/ remoteuser@remoteserver:/path/to/remote/folder/

FTP

If your Moodle hosting provider does not allow ssh (or just do not provide it) and you have simple [File Transfer Protocol FTP] (a File Transfer Protocol) access with a username and a password you can also use:

mkdir /tmp/remote-folder
curlftpfs ftp://username:password@ftp.your-site.com /tmp/remote-folder
rsync -auvtz --delete /tmp/remote-folder /my/local/backup/folder/
umount /tmp/remote-folder
rmdir /tmp/remote-folder

Wget

wget can be used to backup the entire database. For example use something like these commands(tested on cPanel web interface):

wget --http-user=username --http-password=password http://your-site.com:2082/getsqlbackup/moodle.sql.gz

and the entire backup of the Moodle code tree:

wget --http-user=username --http-password=password http://your-site.com:2082/getbackup/backup-your-site.com-`date +"%-m-%d-%Y"`.tar.gz

Some customization might be needed for other web interface like (webmin?)

See also