Quantcast
Channel: Backup and restore
Viewing all articles
Browse latest Browse all 6588

Re: [3.4] Automated backups initial run (1000 courses)

$
0
0
by Ken Task.  

Two part response ....

Install moosh.
https://moodle.org/plugins/pluginversions.php?id=522
get version for your MDL version.

For info on commands:
https://moosh-online.com/

Use it's course-info command to get information about all courses.
The info includes the course size ... good info for size of backups.

moosh commands must be run inside moodle code directory.

Two scripts ... one to get course ID numbers and the other is
for the moosh course-info command.

Script name: getcids - gets all course ID numbers.
Contents of script (really a DB query so you might have to adjust):

mysql -u root -p -e "use moodleDB;select id from mdl_course;"> cids.txt;cat cids.txt;echo '-';wc -l cids.txt

This will output a txt file called cids.txt which you need to edit ...
remove the top two lines ... column heading and course iD 1 which is the front page of Moodle.

Now that you have cids.txt, the next script uses cids.txt with moosh to get each course's info.

Script name: csinfo (course info)
Contents of script:

#!/bin/bash
#
rm couresesinfo.txt;
echo 'CID listing: ';
cat ./cids.txt;
echo '---------------------';
for i in `cat ./cids.txt`
do
   echo '-----------------------' >> coursesinfo.txt;
   echo "Course ID  in que: $i";
moosh -n course-info $i >> coursesinfo.txt;
echo '---------------------------' >> coursesinfo.txt;
done


As csinfo runs you will see:

Course ID  in que: 42
Course ID  in que: 48
Course ID  in que: 270
Course ID  in que: 314
Course ID  in que: 369
Course ID  in que: 2

Text file is being created ... the coursesinfo.txt file whjose sections look like;

The coursesinfo.txt file contains sections that look like:

-----------------------
Course ID: 42
No of contexts: 10
Context by level:
    CONTEXT_MODULE (70):    6
    CONTEXT_BLOCK (80):    4
Context by module:
    forum (6):    1
    resource (14):    3
    scorm (15):    2
Number of role capability overwrites: 0
Role capability overwrites by context:
Number of local role assignments: 0
Locally assigned roles by context:
Number of enrolled users: 3
Users enrolled by role:
    student (5):    3
Number of groups: 0
Group statistics:
    Min number of members in a group:    0
    Max number of members in a group:    0
    Avg number of members in a group:    0
Course modinfo size: 19810
Number of sections: 11
Section statistics:
    Sections visible:    11
    Sections hidden:    0
    Min number of modules in a section:    0
    Max number of modules in a section:    2
    Avg number of modules in a section:    0
Number of grades: 5
Number of log entries: 3
Number of files: 4862
Total file size: 172563351
Cache build time: 0.073500871658325
---------------------------

For backups, the important info is 'Total file size' ... approx size of backup file.

Can use browser to view the coursesinfo.txt file:
https://yoursite/admin/cli/coursesinfo.txt

Then use FireFox browser 'find' for 'Total' which will highlight that line.

Not elegant, but functional.

Part 2 to follow ...



Viewing all articles
Browse latest Browse all 6588

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>