I am currently trialing moodle on a linux ubuntu server and I did find it very easy to get up and running.
My only problem is now my school wants to use moodle so I need to make sure I have everything backed up.
Would I be better off reinstalling moodle on a windows server to make the backups easier or is it not too hard to set up a backup on a linux server to maybe back it up to a NFS share?
Thanks
There are many backup strategies you could employ. I do not think that just because you are going to install Moodle in a predominately Windows environment you should move away from Linux for the sake of backups!
You can easily use a combination of compression and samba shares to copy your moodle backups from a Linux server to a windows backup server. It all depends on what the backup solution in the school is really...
You can easily use a combination of compression and samba shares to copy your moodle backups from a Linux server to a windows backup server. It all depends on what the backup solution in the school is really...
I guess I'll just have to get my head round the scripting and stick with my linux!!??
If you can give me a little more info about your setup I may be able to help you with a backup script that would do the job.
I'm running moodle with a mysql database on linux ubuntu server.
I do have an email server running on another linux box and I do have a script that backs that up and then ryncs the file over to an nfs share which I will place below. Perhaps I could crib off this for most of what i want to do.
#!/bin/bash
#
# Zimbra Backup Script
#
# Variables
TIME=`date +%Y-%m-%d`
DOWN=`date +%u`
DOWD=`date +%A`
SOURCE="/opt/zimbra/"
DEST="/tmp/zcsbackup"
NFSHOST="10.60.28.01"
NFSPATH="/mnt/array1/backup"
NFSMOUNT="/mnt/backup"
ARCHIVENAME="zcsbackup-$DOWN-$DOWD.tar.gz"
ARCHIVE="/tmp/$ARCHIVENAME"
LOG="/var/log/zmbackup.log"
EMAIL="ict@example.com"
function out {
echo "["`date +"%Y-%m-%d %T"`"] $1"
}
#echo ""
#echo "* * * * * * * * * *"
#echo "Zimbra backup"
#echo `date +%Y-%m-%d`
#echo ""
echo ""
out "Zimbra backup"
echo ""
echo ""
out "Stopping services"
echo ""
# Stop Zimbra Services
su - zimbra -c /opt/zimbra/bin/zmcontrol stop
sleep 5
echo ""
out "Zimbra status:"
echo ""
su - zimbra -c /opt/zimbra/bin/zmcontrol status
sleep 10
echo ""
out "Making directory and executing Rsync"
echo ""
# Make directory and sync to it
mkdir $DEST
rsync -aHK --exclude=*.pid $SOURCE $DEST
echo ""
out "Restarting Zimbra services"
echo ""
# Restart Zimbra Services
su - zimbra -c /opt/zimbra/bin/zmcontrol start
sleep 5
echo ""
out "Zimbra status:"
echo ""
su - zimbra -c /opt/zimbra/bin/zmcontrol status
echo ""
out "Creating archive"
echo ""
# Create archive of backed-up directory for transfer
tar -zcf $ARCHIVE -C $DEST .
echo ""
out "Copying to NFS server"
echo ""
mkdir $NFSMOUNT
mount -t nfs $NFSHOST:/$NFSPATH $NFSMOUNT
cp -fv $ARCHIVE $NFSMOUNT/
ls -lah $NFSMOUNT
umount $NFSMOUNT
rm -rfv $NFSMOUNT
echo ""
out "Removing $DEST and $ARCHIVE from local disk"
echo ""
# Remove temp backup destination, samba and archive
rm -rf $DEST
rm -fv $ARCHIVE
echo ""
out "Backup complete!"
echo ""
echo "----------"
I do have an email server running on another linux box and I do have a script that backs that up and then ryncs the file over to an nfs share which I will place below. Perhaps I could crib off this for most of what i want to do.
#!/bin/bash
#
# Zimbra Backup Script
#
# Variables
TIME=`date +%Y-%m-%d`
DOWN=`date +%u`
DOWD=`date +%A`
SOURCE="/opt/zimbra/"
DEST="/tmp/zcsbackup"
NFSHOST="10.60.28.01"
NFSPATH="/mnt/array1/backup"
NFSMOUNT="/mnt/backup"
ARCHIVENAME="zcsbackup-$DOWN-$DOWD.tar.gz"
ARCHIVE="/tmp/$ARCHIVENAME"
LOG="/var/log/zmbackup.log"
EMAIL="ict@example.com"
function out {
echo "["`date +"%Y-%m-%d %T"`"] $1"
}
#echo ""
#echo "* * * * * * * * * *"
#echo "Zimbra backup"
#echo `date +%Y-%m-%d`
#echo ""
echo ""
out "Zimbra backup"
echo ""
echo ""
out "Stopping services"
echo ""
# Stop Zimbra Services
su - zimbra -c /opt/zimbra/bin/zmcontrol stop
sleep 5
echo ""
out "Zimbra status:"
echo ""
su - zimbra -c /opt/zimbra/bin/zmcontrol status
sleep 10
echo ""
out "Making directory and executing Rsync"
echo ""
# Make directory and sync to it
mkdir $DEST
rsync -aHK --exclude=*.pid $SOURCE $DEST
echo ""
out "Restarting Zimbra services"
echo ""
# Restart Zimbra Services
su - zimbra -c /opt/zimbra/bin/zmcontrol start
sleep 5
echo ""
out "Zimbra status:"
echo ""
su - zimbra -c /opt/zimbra/bin/zmcontrol status
echo ""
out "Creating archive"
echo ""
# Create archive of backed-up directory for transfer
tar -zcf $ARCHIVE -C $DEST .
echo ""
out "Copying to NFS server"
echo ""
mkdir $NFSMOUNT
mount -t nfs $NFSHOST:/$NFSPATH $NFSMOUNT
cp -fv $ARCHIVE $NFSMOUNT/
ls -lah $NFSMOUNT
umount $NFSMOUNT
rm -rfv $NFSMOUNT
echo ""
out "Removing $DEST and $ARCHIVE from local disk"
echo ""
# Remove temp backup destination, samba and archive
rm -rf $DEST
rm -fv $ARCHIVE
echo ""
out "Backup complete!"
echo ""
echo "----------"
If you unzip your backups you will see that all of the data is there. The problem arises when you restore. The database files are not being uploaded.
It is quite simple to include in your backup a script a MySQL dump that gets included with the zip / tar file so that you have a complete snapshot of Moodle at backup (Moodle folder, Moodledata folder and SQL dump).
I was by no means trying to provide a complete backup script. That would depend far too much on the environment they are running...
I was by no means trying to provide a complete backup script. That would depend far too much on the environment they are running...