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

Re: Automated backups run OK but not made

$
0
0
by Ken Task.  

One could fiddle a lot with auto backups but from what you say your goal is, might be best to do a little command line foo that doesn't involve auto.

First, look at backup preferences ... and set for no users, no logs, no events - whatever excludes would give you no user backups with just course content.

I do this in code/admin/cli/ ...

First, do script for DB query to get course ID numbers.   Call it getcids.   You fill in $ variables below

looks like:

mysql -u $mddbuser -p$mddbpass -e "use $mddbname;select id from mdl_course;"> cids.txt;cat cids.txt

Edit cids.txt and remove the column label at top and course ID 1 which is your front page and can't be restored anyway.

After editing, looks like:
3
6
7
8
2
5
9

They don't have to be sequential.

Decide where you have enough room to hold the course backups.  My server has a large partition called /home/ and I create a directory there called 'clibackups'.   Root ownerships and permissions are ok.

Next create a bash shell script that will loop through cids.txt and run command line backup of each course.    Call it niclibackups

Looks like:

#!/bin/bash
#
cd /path/to/admin/cli/;
for i in `cat /path/to/admin/cli/cids.txt`
do
    echo "Course ID in que:" $i;
    php backup.php --courseid=$i --destination=/home/clibackups/
done
ls -l /home/clibackups/;
echo 'Done!';

execute: source niclibackups or make niclibackups executable by root.

chmod u+x niclibackups

Then execute: ./niclibackups

200 courses are a lot ... do above during non-prime time for server.

and you might have to use a 'nohup' in front of ./niclibackups with an & on the end of that nohup command to assure it finishes.

nohup = no hang up - assures it will run even if your shell times out.

from /path/to/code/admin/cli/ where niclibackups lives

nohup ./niclibackups &

nohup.out is the log of niclibackups

and one could log out ... then log back in later and watch nohup.out to see how far along it is.

'SoS', Ken


Viewing all articles
Browse latest Browse all 6815

Trending Articles



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