diff options
author | root | 2019-05-19 20:13:18 +1000 |
---|---|---|
committer | root | 2019-05-19 20:13:18 +1000 |
commit | 9caf08846ad3b8e64a6519b8678836e5374cb9b4 (patch) | |
tree | 3fb1b0aa3b7387df71f69a3e75bfcc049c31d22f /scripts/start-sim | |
parent | Kill it with fire! (diff) | |
download | opensim-SC_OLD-9caf08846ad3b8e64a6519b8678836e5374cb9b4.zip opensim-SC_OLD-9caf08846ad3b8e64a6519b8678836e5374cb9b4.tar.gz opensim-SC_OLD-9caf08846ad3b8e64a6519b8678836e5374cb9b4.tar.bz2 opensim-SC_OLD-9caf08846ad3b8e64a6519b8678836e5374cb9b4.tar.xz |
Various script fixups.
Diffstat (limited to 'scripts/start-sim')
-rwxr-xr-x | scripts/start-sim | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/scripts/start-sim b/scripts/start-sim index 86cc90d..bd0815f 100755 --- a/scripts/start-sim +++ b/scripts/start-sim | |||
@@ -14,6 +14,14 @@ date=$(date '+%F_%T') | |||
14 | quiet="" | 14 | quiet="" |
15 | inventory="" | 15 | inventory="" |
16 | 16 | ||
17 | function wait_for_text() | ||
18 | { | ||
19 | while :; do | ||
20 | sleep 10 | ||
21 | ${tmux_command} capture-pane -t ${tmux_session}:"${1}" -p | grep -E "${2}" 2>&1 > /dev/null && return | ||
22 | done | ||
23 | } | ||
24 | |||
17 | if [ $USER = "opensim" ] | 25 | if [ $USER = "opensim" ] |
18 | then | 26 | then |
19 | SUDO="" | 27 | SUDO="" |
@@ -99,6 +107,8 @@ case $(basename $0) in | |||
99 | ${tmux_window} \; attach-session -t "${tmux_session}" | 107 | ${tmux_window} \; attach-session -t "${tmux_session}" |
100 | fi | 108 | fi |
101 | fi | 109 | fi |
110 | |||
111 | ${tmux_send}:"${title}" Enter Enter Enter | ||
102 | ;; | 112 | ;; |
103 | 113 | ||
104 | "backup-inventory") | 114 | "backup-inventory") |
@@ -109,17 +119,19 @@ case $(basename $0) in | |||
109 | cmd="save iar -c ${inventory} / password ${PRGDIR}/../../backups/${user}-${date}.iar" | 119 | cmd="save iar -c ${inventory} / password ${PRGDIR}/../../backups/${user}-${date}.iar" |
110 | # Do it in the highest numbered window. | 120 | # Do it in the highest numbered window. |
111 | ${tmux_send}:"$" "${cmd}" Enter | 121 | ${tmux_send}:"$" "${cmd}" Enter |
112 | ${tmux_send}:"$" "force gc" Enter | 122 | wait_for_text "$" "Saved archive with [[:digit:]]+ items for ${user/_/ }" |
123 | ${tmux_send}:"$" "force gc" Enter Enter Enter | ||
113 | ;; | 124 | ;; |
114 | 125 | ||
115 | "backup-sim") | 126 | "backup-sim") |
116 | cd ${PRGDIR} | ||
117 | $SUDO ${PRGDIR}/gitAR.sh o "${title}" | ||
118 | sim=$(sanitize "${title}") | ||
119 | # Add the full date and time to create the OAR file name. | ||
120 | cmd="save oar --all ${PRGDIR}/../../backups/${sim}-${date}.oar" | ||
121 | if [ -e /var/run/opensim/${tgt}.pid ]; then | 127 | if [ -e /var/run/opensim/${tgt}.pid ]; then |
122 | ${tmux_send}:"[${title}]" "${cmd}" Enter | 128 | cd ${PRGDIR} |
129 | $SUDO ${PRGDIR}/gitAR.sh o "${title}" | ||
130 | sim=$(sanitize "${title}") | ||
131 | # Add the full date and time to create the OAR file name. | ||
132 | cmd="save oar --all ${PRGDIR}/../../backups/${sim}-${date}.oar" | ||
133 | ${tmux_send}:"${title}" "${cmd}" Enter | ||
134 | wait_for_text "${title}" "Finished writing out OAR for ${title}" | ||
123 | # Generate the map tiles, coz the good generator leaks memory badly if you leave it turned on. | 135 | # Generate the map tiles, coz the good generator leaks memory badly if you leave it turned on. |
124 | ${tmux_send}:"${title}" "generate map" Enter | 136 | ${tmux_send}:"${title}" "generate map" Enter |
125 | ${tmux_send}:"${title}" "force gc" Enter Enter Enter | 137 | ${tmux_send}:"${title}" "force gc" Enter Enter Enter |