aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-27 23:58:40 +1000
committerDavid Walter Seikel2016-11-27 23:58:40 +1000
commited0de24e6bc2cac4c20051070710557055b463d0 (patch)
tree888f55c8f7317f96cc00450f886c9d52ac64e8ef /scripts
parentFix "only backup people that have logged in since last time", due to OpenSim ... (diff)
downloadopensim-SC_OLD-ed0de24e6bc2cac4c20051070710557055b463d0.zip
opensim-SC_OLD-ed0de24e6bc2cac4c20051070710557055b463d0.tar.gz
opensim-SC_OLD-ed0de24e6bc2cac4c20051070710557055b463d0.tar.bz2
opensim-SC_OLD-ed0de24e6bc2cac4c20051070710557055b463d0.tar.xz
Various little backup system fixes.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/backup-sims.sh5
-rwxr-xr-xscripts/gitAR.sh19
-rwxr-xr-xscripts/start-sim9
3 files changed, 20 insertions, 13 deletions
diff --git a/scripts/backup-sims.sh b/scripts/backup-sims.sh
index a449e41..b14acca 100755
--- a/scripts/backup-sims.sh
+++ b/scripts/backup-sims.sh
@@ -3,17 +3,18 @@
3source common.sh 3source common.sh
4getPrgDir 4getPrgDir
5 5
6for i in $(seq 99) 6for i in $(seq -w 1 99)
7do 7do
8 j=$(num2name ${i}) 8 j=$(num2name ${i})
9 if [ -e "${PRGDIR}/../config/${j}" ] 9 if [ -e "${PRGDIR}/../config/${j}" ]
10 then 10 then
11 cd ${PRGDIR}/../config/$j 11 pushd ${PRGDIR}/../config/${j} >/dev/null
12 # Find out the size of the last backup, base our later sleep on that, but do it now before backup-sim packs it away. 12 # Find out the size of the last backup, base our later sleep on that, but do it now before backup-sim packs it away.
13 sizeSleep=`sleepPerSize o "$(getSimName ${i})"` 13 sizeSleep=`sleepPerSize o "$(getSimName ${i})"`
14 ./backup-sim 14 ./backup-sim
15 # Sleep for a while, so that there is plenty of time to do the backup, 15 # Sleep for a while, so that there is plenty of time to do the backup,
16 # and we are not keeping the computer very busy if there are lots of sims. 16 # and we are not keeping the computer very busy if there are lots of sims.
17 sleep ${sizeSleep} 17 sleep ${sizeSleep}
18 popd > /dev/null
18 fi 19 fi
19done 20done
diff --git a/scripts/gitAR.sh b/scripts/gitAR.sh
index 25cab48..bbcc761 100755
--- a/scripts/gitAR.sh
+++ b/scripts/gitAR.sh
@@ -51,18 +51,25 @@ cat >.gitattributes <<- zzzzEOFzzzz
51*.r32 -delta -diff -text 51*.r32 -delta -diff -text
52*.tga -delta -diff -text 52*.tga -delta -diff -text
53zzzzEOFzzzz 53zzzzEOFzzzz
54git add .gitattributes &>>../log
55# Coz git insists. 54# Coz git insists.
56git config user.email "opensim@$(hostname -A | cut -d ' ' -f 1)" 55git config user.email "opensim@$(hostname -A | cut -d ' ' -f 1)"
57git config user.name "opensim" 56git config user.name "opensim"
58 57
58# Git is such a pedantic bitch, let's just fucking ignore any errors it gives due to lack of anything to do.
59# Even worse the OpenSim devs breaking logout tracking gives git plenty of nothing to do. lol
60
59# Looping through them in case there's a bunch of I/OARs from previous versions of this script. 61# Looping through them in case there's a bunch of I/OARs from previous versions of this script.
60find ../.. -maxdepth 1 -type f -name ${name}-*.${type}ar | sort | while read file; do 62# Ignore files of zero size that OpenSim might create.
63find ../.. -maxdepth 1 -type f -name "${name}-*.${type}ar" -size '+0c' | sort | while read file; do
61 # Deal with deletions in the inventory / sim, easy method, which becomes a nop for files that stay in the git add below. 64 # Deal with deletions in the inventory / sim, easy method, which becomes a nop for files that stay in the git add below.
62 git rm -fr * &>>../log && \ 65 git rm -fr * &>>../log #|| echo "ERROR - Could not clean git for ${file} !" >>../errors
63 nice -n 19 tar -xzf "${file}" || echo "ERROR - Could not unpack ${file} !" >>../errors 66 if [ ! -f ../errors ]; then
67 nice -n 19 tar -xzf "${file}" || echo "ERROR - Could not unpack ${file} !" >>../errors
68 fi
64 if [ ! -f ../errors ]; then 69 if [ ! -f ../errors ]; then
65 git add * &>>../log && git add */\* &>>../log 70 git add * &>>../log
71 git add */\* &>>../log #|| echo "ERROR - Could not add ${file} to git!" >>../errors
72 git add .gitattributes &>>../log
66 # Magic needed to figure out if there's anything to commit. 73 # Magic needed to figure out if there's anything to commit.
67 # After all the pain to get this to work, there's an ever changing timestamp in archive.xml that screws it up. 74 # After all the pain to get this to work, there's an ever changing timestamp in archive.xml that screws it up.
68 # Like this system didn't have enough timestamps in it already. lol 75 # Like this system didn't have enough timestamps in it already. lol
@@ -99,5 +106,3 @@ if [ -f ${PRGDIR}/../../backups/temp_backup${type}_${name}/errors ]; then
99else 106else
100 rm -fr ${PRGDIR}/../../backups/temp_backup${type}_${name} 107 rm -fr ${PRGDIR}/../../backups/temp_backup${type}_${name}
101fi 108fi
102
103echo -n ${name}
diff --git a/scripts/start-sim b/scripts/start-sim
index 72bb9ba..6c87e09 100755
--- a/scripts/start-sim
+++ b/scripts/start-sim
@@ -101,7 +101,8 @@ case $(basename $0) in
101 ;; 101 ;;
102 102
103 "backup-inventory") 103 "backup-inventory")
104 user=$($SUDO ${PRGDIR}/gitAR.sh i "${inventory}") 104 $SUDO ${PRGDIR}/gitAR.sh i "${inventory}"
105 user=$(sanitize "${inventory}")
105 # Add the full date and time to create the IAR file name. 106 # Add the full date and time to create the IAR file name.
106 cmd="save iar -c ${inventory} / password ${PRGDIR}/../../backups/${user}-${date}.iar" 107 cmd="save iar -c ${inventory} / password ${PRGDIR}/../../backups/${user}-${date}.iar"
107 # Do it in the highest numbered window. 108 # Do it in the highest numbered window.
@@ -110,13 +111,13 @@ case $(basename $0) in
110 ;; 111 ;;
111 112
112 "backup-sim") 113 "backup-sim")
113 sim=$($SUDO ${PRGDIR}/gitAR.sh o "${title}") 114 $SUDO ${PRGDIR}/gitAR.sh o "${title}"
115 sim=$(sanitize "${title}")
114 # Add the full date and time to create the OAR file name. 116 # Add the full date and time to create the OAR file name.
115 cmd="save oar --all ${PRGDIR}/../../backups/${sim}-${date}.oar" 117 cmd="save oar --all ${PRGDIR}/../../backups/${sim}-${date}.oar"
116 if [ -e /var/run/opensim/${tgt}.pid ]; then 118 if [ -e /var/run/opensim/${tgt}.pid ]; then
117 ${tmux_send}:"[${title}]" "${cmd}" Enter 119 ${tmux_send}:"[${title}]" "${cmd}" Enter
118 # Wait a bit, then generate the map tiles, coz the good generator leaks memory badly if you leave it turned on. 120 # Generate the map tiles, coz the good generator leaks memory badly if you leave it turned on.
119 sleep 30
120 ${tmux_send}:"[${title}]" "generate map" Enter 121 ${tmux_send}:"[${title}]" "generate map" Enter
121 ${tmux_send}:"[${title}]" "force gc" Enter 122 ${tmux_send}:"[${title}]" "force gc" Enter
122 else 123 else