Skip to content

Instantly share code, notes, and snippets.

@xaxxontech
Last active May 22, 2020 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save xaxxontech/4c1c671958e130d3b821f4d1321e4bdb to your computer and use it in GitHub Desktop.
Save xaxxontech/4c1c671958e130d3b821f4d1321e4bdb to your computer and use it in GitHub Desktop.
Oculusprime Server Java Application Launch Script
#! /bin/bash
echo ""
echo "OCULUS PRIME server"
echo "Use quitserver command to exit"
# set current working dir if necessary
export DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd $DIR
# clean out buggy xfce/ubuntu session autostart items
rm -rf $HOME/.cache/sessions/*
if [ -z "$RED5_HOME" ]; then
export RED5_HOME=`pwd`;
fi
# use appropriate openCV native library for architecture
export OPENCVLIB="openCVlib_x86"
case $(uname -m) in
*arm*) export OPENCVLIB="openCVlib_arm";;
esac
while true; do
#unpack update files if exists
if [ -d webapps/update ]; then
echo "found update package"
# run additional update.sh if exists
if [ -f webapps/update/update.sh ]; then
mv webapps/update/update.sh .
chmod u+x update.sh
./update.sh
rm -f update.sh
fi
# transfer existing data
mv webapps/oculusPrime/navigationlog/ webapps/update/
mv webapps/oculusPrime/streams/ webapps/update/
mv webapps/oculusPrime/framegrabs/ webapps/update/
mv webapps/oculusPrime/rss.xml webapps/update/
rm -rf webapps/oculusPrime
mv webapps/update webapps/oculusPrime
mv -f ./webapps/oculusPrime/version.nfo .
fi
if [ -f restart ]; then
rm -f restart
fi
# delete eclipse garbage if any
if [ -d webapps/RemoteSystemsTempFiles ]; then
rm -rf webapps/RemoteSystemsTempFiles
fi
# set high performance java options (from red5-highperf.sh)
#export JVM_OPTS="-Xmx1024m -Xms512m -Xss256k -XX:+AggressiveOpts -XX:+DisableExplicitGC -XX:ParallelGCThreads=4 -XX:+UseConcMarkSweepGC -Xverify:none -XX:+TieredCompilation -XX:+UseBiasedLocking -XX:+UseStringCache -XX:+UseParNewGC -XX:SurvivorRatio=16 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=31 -Djava.net.preferIPv4Stack=true -XX:InitialCodeCacheSize=8m -XX:ReservedCodeCacheSize=32m -Dorg.terracotta.quartz.skipUpdateCheck=true -Djava.library.path=${RED5_HOME}/openCVlib"
export JVM_OPTS="-Xverify:none -XX:+TieredCompilation -XX:+UseBiasedLocking -XX:InitialCodeCacheSize=8m -XX:ReservedCodeCacheSize=32m -Dorg.terracotta.quartz.skipUpdateCheck=true
-Djava.library.path=${RED5_HOME}/${OPENCVLIB} -Djava.security.egd=file:/dev/./urandom"
# start Red5
./red5.sh >> ./log/jvm.stdout 2>&1
echo "stopping Oculus Prime"
#restart (continue loop) if flag exists
if [ -f restart ]; then
echo "restarting"
sleep 5
else
echo "exiting"
break
fi
done
sleep 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment