Difference between revisions of "USB OFFLINE: Ubuntu 24.04 Moodle Backup"

From OnnoWiki
Jump to navigation Jump to search
 
Line 18: Line 18:
 
  rm -Rf /var/moodledata
 
  rm -Rf /var/moodledata
 
  tar zxvf moodlecms.tar.gz
 
  tar zxvf moodlecms.tar.gz
  mv /var/www/html/pustaka/backupmoodle/var/www/moodle/ /var/www/html/
+
  mv /var/www/html/pustaka/backupmoodle/var/www/html/moodle/ /var/www/html/
 
  tar zxvf moodledata.tar.gz
 
  tar zxvf moodledata.tar.gz
 
  mv /var/www/html/pustaka/backupmoodle/var/moodledata /var
 
  mv /var/www/html/pustaka/backupmoodle/var/moodledata /var

Latest revision as of 04:47, 1 September 2024

Moodle Backup

mkdir -p /var/www/html/pustaka/backupmoodle
cd /var/www/html/pustaka/backupmoodle
mv moodle-database.sql.gz moodle-database-old.sql.gz
mysqldump -h localhost -u moodle --password=moodle -C -Q -e --create-options moodle > moodle-database.sql
gzip moodle-database.sql
tar czf /var/www/html/pustaka/backupmoodle/moodlecms.tar.gz /var/www/html/moodle
tar czf /var/www/html/pustaka/backupmoodle/moodledata.tar.gz /var/moodledata/
chmod -Rf 777 /var/www/html/pustaka/backupmoodle
chown -Rf nobody: /var/www/html/pustaka/backupmoodle

Moodle Restore

cp /var/www/html/moodle/config.php /tmp/
cd /var/www/html/pustaka/backupmoodle/
rm -Rf /var/www/html/moodle
rm -Rf /var/moodledata
tar zxvf moodlecms.tar.gz
mv /var/www/html/pustaka/backupmoodle/var/www/html/moodle/ /var/www/html/
tar zxvf moodledata.tar.gz
mv /var/www/html/pustaka/backupmoodle/var/moodledata /var
rm -Rf /var/www/html/pustaka/backupmoodle/var/
cp /tmp/config.php /var/www/html/moodle
chown -Rf www-data: /var/www/html/moodle
chown -Rf www-data: /var/moodledata &
cd /var/www/html/pustaka/backupmoodle
gunzip moodle-database.sql.gz
mysqladmin --user=moodle --password=moodle --force drop moodle
mysqladmin --user=moodle --password=moodle create moodle
mysql -u moodle -pmoodle moodle < /var/www/html/pustaka/backupmoodle/moodle-database.sql
service mysql stop
service mysql start