From 9caf08846ad3b8e64a6519b8678836e5374cb9b4 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 19 May 2019 20:13:18 +1000 Subject: Various script fixups. --- InstallItAll.sh | 7 +++++-- scripts/start-sim | 26 +++++++++++++++++++------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/InstallItAll.sh b/InstallItAll.sh index 1efd0f5..81ff54f 100755 --- a/InstallItAll.sh +++ b/InstallItAll.sh @@ -65,12 +65,15 @@ grant all on $MYSQL_DB.* to $OS_USER@localhost; FLUSH PRIVILEGES; zzzzEOFzzz -sudo adduser --system --shell /bin/bash --group $OS_USER +echo "Setting up OpenSim." +sudo adduser --system --shell /bin/false --group $OS_USER sudo addgroup $USER $OS_USER echo "Building OpenSim." ./runprebuild.sh ./nant-color +#xbuild /target:clean +#xbuild /p:TargetFrameworkVersion="v4.5" echo "Setting up OpenSim." sudo rm -fr $OSPATH/opensim-IG_* @@ -123,5 +126,5 @@ sudo chown $USER /home/$OS_USER/.tmux.conf sudo chmod 644 /home/$OS_USER/.tmux.conf sudo scripts/fix_var_run.sh - +sudo cat scripts/opensim-crontab.txt | sudo crontab -u $OS_USER - echo "Done installing OpenSim." 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') quiet="" inventory="" +function wait_for_text() +{ + while :; do + sleep 10 + ${tmux_command} capture-pane -t ${tmux_session}:"${1}" -p | grep -E "${2}" 2>&1 > /dev/null && return + done +} + if [ $USER = "opensim" ] then SUDO="" @@ -99,6 +107,8 @@ case $(basename $0) in ${tmux_window} \; attach-session -t "${tmux_session}" fi fi + + ${tmux_send}:"${title}" Enter Enter Enter ;; "backup-inventory") @@ -109,17 +119,19 @@ case $(basename $0) in cmd="save iar -c ${inventory} / password ${PRGDIR}/../../backups/${user}-${date}.iar" # Do it in the highest numbered window. ${tmux_send}:"$" "${cmd}" Enter - ${tmux_send}:"$" "force gc" Enter + wait_for_text "$" "Saved archive with [[:digit:]]+ items for ${user/_/ }" + ${tmux_send}:"$" "force gc" Enter Enter Enter ;; "backup-sim") - cd ${PRGDIR} - $SUDO ${PRGDIR}/gitAR.sh o "${title}" - sim=$(sanitize "${title}") - # Add the full date and time to create the OAR file name. - cmd="save oar --all ${PRGDIR}/../../backups/${sim}-${date}.oar" if [ -e /var/run/opensim/${tgt}.pid ]; then - ${tmux_send}:"[${title}]" "${cmd}" Enter + cd ${PRGDIR} + $SUDO ${PRGDIR}/gitAR.sh o "${title}" + sim=$(sanitize "${title}") + # Add the full date and time to create the OAR file name. + cmd="save oar --all ${PRGDIR}/../../backups/${sim}-${date}.oar" + ${tmux_send}:"${title}" "${cmd}" Enter + wait_for_text "${title}" "Finished writing out OAR for ${title}" # Generate the map tiles, coz the good generator leaks memory badly if you leave it turned on. ${tmux_send}:"${title}" "generate map" Enter ${tmux_send}:"${title}" "force gc" Enter Enter Enter -- cgit v1.1