mirror of
https://github.com/Misterblue/opensim-docker.git
synced 2026-07-30 11:22:14 +00:00
Renames files into new positions to simplify and make organization clearer.
This commit is contained in:
Executable
+8
@@ -0,0 +1,8 @@
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
set autoindent
|
||||
set ff=unix
|
||||
|
||||
set background=dark
|
||||
syntax enable
|
||||
@@ -0,0 +1,18 @@
|
||||
This directory of files are copied into /home/opensim to act as the
|
||||
startup and operation scripts for the instance of OpenSim that is running
|
||||
in the docker container.
|
||||
|
||||
`bootOpenSim.sh` is run when the docker container starts and is responsible
|
||||
for seeing that the configuration files and other setup (like DB) are initialized.
|
||||
This script calls `firstTimeSetup.sh` for the first ever boot to do any
|
||||
initial setup.
|
||||
This script will fail if the environment variables `CONFIGKEY` or `EXTERNAL_HOSTNAME`
|
||||
are not set.
|
||||
|
||||
`run.opensim.sh` starts the OpenSimulator instance.
|
||||
|
||||
`checkOpenSim.sh` is run periodically to make sure that the OpenSimulator instance
|
||||
is running and, if not, save crash information (`captureCrash.sh`) and then
|
||||
restart OpenSimulator.
|
||||
|
||||
`crontab` is set initially to run `checkOldLogFiles.sh` which rotates `OpenSim.log`.
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#! /bin/bash
|
||||
# Run when booting the Docker file.
|
||||
# Checks to see if this is the very first time in which case it
|
||||
# runs the first time setup. Otherwise it just sets things running.
|
||||
|
||||
export OPENSIMHOME=/home/opensim
|
||||
export VERSIONDIR=$OPENSIMHOME/VERSION
|
||||
export OPENSIMBIN=$OPENSIMHOME/opensim/bin
|
||||
export OPENSIMCONFIG=$OPENSIMBIN/config
|
||||
|
||||
FIRSTTIMEFLAG=$OPENSIMHOME/.firstTimeFlag
|
||||
|
||||
# Some setup environment variables should have been set
|
||||
for requiredEnv in "CONFIGKEY" "EXTERNAL_HOSTNAME" ; do
|
||||
if [[ -z "${!requiredEnv}" ]] ; then
|
||||
echo "Environment variable $requiredEnv is not set"
|
||||
exit 5
|
||||
fi
|
||||
done
|
||||
|
||||
# If this configuration has stuff to do...
|
||||
if [[ -e "$OPENSIMCONFIG/setup.sh" ]] ; then
|
||||
$OPENSIMCONFIG/setup.sh
|
||||
fi
|
||||
|
||||
if [[ ! -e "$FIRSTTIMEFLAG" ]] ; then
|
||||
# First time setup for the OpenSim running and crash checking scripts
|
||||
cd "$OPENSIMHOME"
|
||||
./firstTimeSetup.sh
|
||||
touch "$FIRSTTIMEFLAG"
|
||||
rm -f NOOPENSIM
|
||||
fi
|
||||
|
||||
# Start Opensim
|
||||
echo "Starting OpenSimulator version $(cat $VERSIONDIR/OS_VERSION) with opensim-docker version $(cat $VERSIONDIR/OS_DOCKER_IMAGE_VERSION)"
|
||||
|
||||
cd "$OPENSIMHOME"
|
||||
./run.opensim.sh
|
||||
while true ; do
|
||||
sleep 300
|
||||
./checkOpenSim.sh
|
||||
done
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#! /bin/bash
|
||||
# Copy physics logs from usual physics log directory into
|
||||
# a subdirectory of the log dir so they won't get deleted.
|
||||
# Also saves the OpenSimulator log and screen files in subdir.
|
||||
|
||||
DATETAG=$1
|
||||
|
||||
OPENSIMHOME=${OPENSIMHOME:-/home/opensim}
|
||||
|
||||
if [[ -z "$DATETAG" ]] ; then
|
||||
DATETAG=$(date +%Y%m%d.%H%M)
|
||||
fi
|
||||
|
||||
OPENSIMBIN=${OPENSIMBIN:-$OPENSIMHOME/opensim/bin}
|
||||
|
||||
LOGDIR=$OPENSIMHOME/logs
|
||||
SAVEDIR=$LOGDIR/$DATETAG
|
||||
|
||||
echo "Capturing crash from $OPENSIMBIN into $SAVEDIR"
|
||||
|
||||
mkdir -p $SAVEDIR
|
||||
|
||||
cd $LOGDIR
|
||||
for logfile in phys*.log ; do
|
||||
if [[ -e "$logfile" ]] ; then
|
||||
mv "$logfile" "$SAVEDIR"
|
||||
fi
|
||||
done
|
||||
if [[ -e "$OPENSIMBIN/screenlog.0" ]] ; then
|
||||
mv $OPENSIMBIN/screenlog.0 $SAVEDIR
|
||||
fi
|
||||
if [[ -e "$OPENSIMBIN/OpenSim.log" ]] ; then
|
||||
mv $OPENSIMBIN/OpenSim.log $SAVEDIR
|
||||
fi
|
||||
|
||||
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#! /bin/bash
|
||||
# Clean out old log files in the log directory.
|
||||
# Does not delete saved log directories.
|
||||
|
||||
OPENSIMHOME=${OPENSIMHOME:-/home/opensim}
|
||||
|
||||
TIMEAGO=${OPENSIMHOME}/.lastLogCleanup
|
||||
|
||||
LOGDIR="${OPENSIMHOME}/logs"
|
||||
if [[ -d "$LOGDIR" ]] ; then
|
||||
rm -f "$TIMEAGO"
|
||||
touch --date="-1 hours" "$TIMEAGO"
|
||||
|
||||
cd "$LOGDIR"
|
||||
for file in phys*.log scene-*.log ; do
|
||||
if [[ -e "$file" ]] ; then
|
||||
if [[ $TIMEAGO -nt "$file" ]] ; then
|
||||
rm -f "$file"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#! /bin/bash
|
||||
# Check to see if OpenSim is running and restart if it is not
|
||||
|
||||
OPENSIMHOME=${OPENSIMHOME:-/home/opensim}
|
||||
OPENSIMBIN=${OPENSIMBIN:-/home/opensim/opensim/bin}
|
||||
|
||||
CRASHLOG=${OPENSIMHOME}/crashlog.log
|
||||
HDR="$(date +%Y%m%d%H%M):"
|
||||
|
||||
LASTCRASH=${OPENSIMHOME}/.lastCrash
|
||||
TIMEAGO=${OPENSIMHOME}/.lastTimeAgo
|
||||
|
||||
cd
|
||||
|
||||
if [[ -e "${OPENSIMHOME}/NOOPENSIM" ]] ; then
|
||||
exit 5
|
||||
fi
|
||||
|
||||
flag=$(ps -efa | grep SCREEN | grep OpenSimScreen)
|
||||
|
||||
if [[ -z "$flag" ]] ; then
|
||||
echo "$HDR Found crashed OpenSim regions"
|
||||
rm -f $TIMEAGO
|
||||
# If crashed last time, don't keep restarting over and over.
|
||||
touch --date="-1 hours" $TIMEAGO
|
||||
if [[ ! -e $LASTCRASH || $TIMEAGO -nt $LASTCRASH ]] ; then
|
||||
echo "$HDR Capturing OpenSim crash"
|
||||
${OPENSIMHOME}/captureCrash.sh
|
||||
rm -f $LASTCRASH
|
||||
touch $LASTCRASH
|
||||
fi
|
||||
echo "$HDR Restarting OpenSim regions"
|
||||
${OPENSIMHOME}/run.opensim.sh
|
||||
fi >> $CRASHLOG
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
*/30 * * * * /home/opensim/checkOldLogFiles.sh
|
||||
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#! /bin/bash
|
||||
# Run the first time to setup the environment for OpenSimulator control
|
||||
OPENSIMHOME=${OPENSIMHOME:-/home/opensim}
|
||||
OPENSIMBIN=${OPENSIMBIN:-$OPENSIMHOME/opensim/bin}
|
||||
|
||||
# Setup the crontab entry for this account so OpenSim stays running
|
||||
crontab "${OPENSIMHOME}/crontab"
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#! /bin/bash
|
||||
# This file is run for initial configuration and is not run thereafter.
|
||||
|
||||
# Script that walks ./config-include and over-writes all INI files with empty contents.
|
||||
# This also creates empty INI files for all the *.example files.
|
||||
|
||||
if [[ ! -d "./config-include" ]] ; then
|
||||
echo "./config-include directory DOES NOT EXIST in the current directory"
|
||||
echo "NOT DOING ANYTHING"
|
||||
exit 5
|
||||
fi
|
||||
|
||||
TEMPFILE=/tmp/configInclude$$
|
||||
rm -f "$TEMPFILE"
|
||||
cat > "$TEMPFILE" << EOFFFF
|
||||
; This file exists because this file is the default architecture include
|
||||
; in OpenSim.ini.
|
||||
; Look for the real configuration in bin/config which overlays settings.
|
||||
EOFFFF
|
||||
|
||||
for iniFile in $(find ./config-include -name \*.ini ) ; do
|
||||
cp "$TEMPFILE" "$iniFile"
|
||||
done
|
||||
|
||||
for exampleFile in $(find ./config-include -name \*.example) ; do
|
||||
cp "$TEMPFILE" "${exampleFile%%.example}"
|
||||
done
|
||||
|
||||
rm -f "$TEMPFILE"
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#! /bin/bash
|
||||
# Runs the simulators with screen
|
||||
|
||||
OPENSIMBIN=${OPENSIMBIN:-/home/opensim/opensim/bin}
|
||||
cd "$OPENSIMBIN"
|
||||
|
||||
rm -f screenlog.0
|
||||
rm -f *.log
|
||||
|
||||
export MONO_THREADS_PER_CPU=100
|
||||
# parameters suggested by Ubit (20170526)
|
||||
ulimit -s 262144
|
||||
export MONO_GC_PARAMS="soft-heap-limit=1280m,minor=split,promotion-age=14"
|
||||
export MONO_ENV_OPTIONS="--desktop"
|
||||
|
||||
screen -L -S OpenSimScreen -p - -d -m mono OpenSim.exe -console=basic
|
||||
# screen -L -S OpenSimScreen -p - -d -m mono --profile=log:sample=cycles/100 OpenSim.exe -console=basic
|
||||
# screen -L -S OpenSimScreen -p - -d -m mono --profile=log:sample=instr/100 OpenSim.exe -console=basic
|
||||
# screen -L -S OpenSimScreen -p - -d -m mono --profile=log:noalloc,calls,maxframes=4 OpenSim.exe -console=basic
|
||||
|
||||
# To analyze:
|
||||
# mprof-report --traces output.mlpd > /tmp/frog2
|
||||
# mprof-report --reports=sample output.mlpd
|
||||
# mprof-report --reports=sample --verbose output.mlpd
|
||||
# mprof-report --reports=call --verbose output.mlpd
|
||||
|
||||
Executable
Reference in New Issue
Block a user