It’s sloppy, but most importantly it works, and it backs up EVERYTHING. Terrain maps, world map image, .oar, .xml, all three .ini files, mysql database, etc.
I based this off the backup script here:
I’m running Ubuntu 11.04 server, x64 btw and this all works.
I store both scripts in /home/username/backupdir/scripts, the shell script gets run as a cron job.
#!/bin/sh
;Not that it *really* matter that we tell people, but I think it's polite, heh.
screen -S opensim -p 0 -X eval 'stuff "alert Beginning full simulator backup, things might be slow for a bit.^M"'
;Yes, I'm redundant, this is just in case I missed something
cd /home/username/backupdir
;Copy the old backups to a holding directory, I clean them out by hand every so often. This could be an offsite location.
mv /home/username/backupdir/*.* /home/username/backupdir/old
;This line runs the second command script inside the opensim process.
screen -S opensim -p 0 -X eval 'stuff "command-script /home/username/backupdir/scripts/osbackup.txt^M"'
;Now dump the mysql data to zip and date it.
mysqldump -ulogin -ppassword opensim | gzip > /home/username/backupdir/opensimbackup_`date +%Y%m%d_%H%M%S`.sql.gz
;Copy and date the 3 .ini files
cp /home/username/opensim/bin/OpenSim.ini /home/username/backupdir/opensim_`date +%Y%m%d_%H%M%S`.ini
cp /home/username/opensim/bin/Regions/Regions.ini /home/username/backupdir/regions_`date +%Y%m%d_%H%M%S`.ini
cp /home/username/opensim/bin/config-include/StandaloneCommon.ini /home/username/backupdir/standalonecommon_`date +%Y%m%d_%H%M%S`.ini
;The next line is just a delay so the .oar output can finish, it might take your server much longer, change as needed.
sleep 30
;There is likely a much more efficient way to do the following, but this was what I could figure out
timestamp=$(date)
;these rename the opensim dumped files to add timestamps to the names. I think this makes them easier to manage later.
for f in epsilon.*
do mv "$f" "epsilon_$timestamp.${f#epsilon.}"
done
for f in techrealms.*
do mv "$f" "techrealms_$timestamp.${f#techrealms.}"
done
for f in theta.*
do mv "$f" "theta_$timestamp.${f#theta.}"
done
for f in delta.*
do mv "$f" "delta_$timestamp.${f#delta.}"
done
for f in connections.*
do mv "$f" "connections_$timestamp.${f#connections.}"
done
; Guessing this could also probably inform something in-world that could record backups. I'm not sure how tho
screen -S opensim -p 0 -X eval 'stuff "alert Backup complete, thank you.^M"'
This second script is executed inside the screen that is running opensim.
;Script Name = osbackup.txt
;executed with "command-script /home/username/backupdir/scripts/osbackup.txt" inside opensim
;
change region root
; Persist objects to the database now
backup
;
change region techrealms
; export world map image
export-map /home/username/backupdir/techrealms.jpg
; save terrain
terrain save /home/username/backupdir/techrealms.r32
; save prims to XML
save xml2 /home/username/backupdir/techrealms.xml
; save the current region to an opensim archive
save oar /home/username/backupdir/techrealms.oar
;
; repeat as needed
;
change region delta
export-map /home/username/backupdir/delta.jpg
terrain save /home/username/backupdir/delta.r32
save xml2 /home/username/backupdir/delta.xml
save oar /home/username/backupdir/delta.oar
;
change region theta
export-map /home/username/backupdir/theta.jpg
terrain save /home/username/backupdir/theta.r32
save xml2 /home/username/backupdir/theta.xml
save oar /home/username/backupdir/theta.oar
;
change region epsilon
export-map /home/username/backupdir/epsilon.jpg
terrain save /home/username/backupdir/epsilon.r32
save xml2 /home/username/backupdir/epsilon.xml
save oar /home/username/backupdir/epsilon.oar
;
change region connections
export-map /home/username/backupdir/connections.jpg
terrain save /home/username/backupdir/connections.r32
save xml2 /home/username/backupdir/connections.xml
save oar /home/username/backupdir/connections.oar
Use them however you want. If someone wants to clean them up for me that would be appreciated.
Thanks & good luck.
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
38 queries. 0.058 seconds