How to take Moodle Full Backup daily using commands in ubuntu server?
Does this help?
http://docs.moodle.org/27/en/Site_backup
Basically 3 parts need backup but maybe not daily (depends upon size of site/how often used/etc). Below examples for a CentOS/RHEL/Fedora flavored boxen - adjust locations for Ubuntu and preferences.
1. code directory (doesn't change daily only when site is updated or upgraded)
tar -cvf /home/backup/moodle-code[vr#]-$(date +%Y%m%d%-H%M%S).tar /var/www/html/moodle
where [vr#] is the version of moodle.
2. the DB - mysqldump with a date/time stamp in the file name to get daily
mysqldump -u root -p'[yourmysqlpassword]' moodle > /home/backup/moodle$(date +%Y%m%d%-H%M%S).sql
This could be run from cron job.
3. the data directory (daily could require a dedicated drive/resource for creating a backup as in use of tar. rsync might be a better choice IF space is limited)
tar -cvf /home/backup/moodle-data-$(date +%Y%m%d%-H%M%S).tar /var/www/moodledata
One could use tar to backup only that which is needed to restore ... moodledata/filedir moodledata/geoip (if using) moodledata/moodleorgca.crt (if using) moodledata/repository (if using)
All above should be executed by root user or in your case sudo.
Consider the above to be a 'poor man's solution' - and each of the above could be placed into manually created scripts so that busy admin user can quickly 'get 'er done'. In /usr/local/bin/ have four scripts owned by root user and executable by root user only:
backupcode, backupdb, backupdata, backupall
'spirit of sharing', Ken