summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormr <mr@mrautenberg.de>2011-05-23 13:33:07 +0200
committermr <mr@mrautenberg.de>2011-05-23 13:33:07 +0200
commit22eec6d44e20612bf75ec0843e8d53de6783ec9f (patch)
tree8cb486c694fe4569f2b4e91f6d1796306c575983
parent0d550625e70e8e2149ef911d00d83098951ed4fc (diff)
parent7eadbe25386b694af1be77f837c744a9fba08c29 (diff)
Merge branch 'development' of github.com:opentox/install into development
-rw-r--r--environment_update.sh77
-rwxr-xr-xopentox-webservices.sh4
2 files changed, 77 insertions, 4 deletions
diff --git a/environment_update.sh b/environment_update.sh
new file mode 100644
index 0000000..d0beae4
--- /dev/null
+++ b/environment_update.sh
@@ -0,0 +1,77 @@
+#!/bin/sh
+# Update script for OpenTox-ruby and webservices
+# Authors: Andreas Maunz, David Vorgrimmler
+# This script updates a productiv version of IST Opentox Services. All data will be saved and recovered.
+# Make sure your web services are down befor running this script.
+# You may modify some variables e.g. HOME, OTPREFIX, BACKUP_DIR.
+# opentox/install is needed and has to be configured
+
+HOME="/home/opentox"
+. $HOME/.opentox-ui.sh
+
+OTPREFIX="$HOME/opentox"
+BACKUP_DIR="$OTPREFIX/ot-server-backup"
+mkdir $BACKUP_DIR >/dev/null 2>&1
+mkdir -p $BACKUP_DIR/tmp/dataset/public >/dev/null 2>&1
+mkdir -p $BACKUP_DIR/tmp/model/public >/dev/null 2>&1
+mkdir -p $BACKUP_DIR/tmp/validation >/dev/null 2>&1
+#mkdir -p $BACKUP_DIR/tmp/log >/dev/null 2>&1
+
+
+echo "Creating backup of www..."
+TAR_NAME=$BACKUP_DIR/"www_`date +%y%m%d`.tar.gz"
+
+if [ -e $TAR_NAME ] || tar czvf $TAR_NAME "$OTPREFIX/opentox-ruby/www"; then
+ echo
+ echo "Will delete www in 10s! Press Ctrl+C to abort..."
+ sleep 10
+ sudo rm -rf "$OTPREFIX/opentox-ruby/www"
+fi
+
+
+NGINX="`which nginx`"
+RAKE="`which rake`"
+
+if ! [ -e "$RAKE" ]; then
+ echo "Rake not found."
+ exit 1
+fi
+if ! [ -e "$NGINX" ]; then
+ echo "Nginx not found."
+ exit 1
+fi
+if ! cd "$OTPREFIX/install"; then
+ echo "$OTPREFIX/install dir not found"
+fi
+
+
+OTINSTALL="$OTPREFIX/install/opentox-webservices.sh"
+if ! [ -e "$OTINSTALL" ]; then
+ echo "$OTINSTALL not found."
+ exit 1
+fi
+chmod +x $OTINSTALL
+`$OTINSTALL`
+echo "$OTINSTALL script end."
+
+
+OTRUBYINSTALL="$OTPREFIX/install/opentox-ruby.sh"
+if ! [ -e "$OTRUBYINSTALL" ]; then
+ echo "$OTRUBYINSTALL not found."
+ exit 1
+fi
+chmod +x $OTRUBYINSTALL
+`$OTRUBYINSTALL`
+echo "$OTRUBYINSTALL script end."
+
+
+echo "Extracting backup of www..."
+cd /
+DEST_DATASET=`echo "$OTPREFIX/opentox-ruby/www/opentox/dataset/public/*yaml" | sed 's/.\(.*\)/\1/'`
+DEST_MODEL=`echo "$OTPREFIX/opentox-ruby/www/opentox/model/public/*yaml" | sed 's/.\(.*\)/\1/'`
+DEST_REPORTS=`echo "$OTPREFIX/opentox-ruby/www/opentox/validation/reports" | sed 's/.\(.*\)/\1/'`
+tar xzvf $TAR_NAME --wildcards $DEST_DATASET
+tar xzvf $TAR_NAME --wildcards $DEST_MODEL
+tar xzvf $TAR_NAME $DEST_REPORTS
+cd -
+echo "End of script."
diff --git a/opentox-webservices.sh b/opentox-webservices.sh
index 91d402e..618404c 100755
--- a/opentox-webservices.sh
+++ b/opentox-webservices.sh
@@ -33,10 +33,6 @@ fi
LOG="/tmp/`basename $0`-log.txt"
-if ! id opentox >>$LOG 2>&1; then
- cmd="sudo adduser --system opentox" && run_cmd "$cmd" "User 'opentox'"
-fi
-
echo
echo "Webservices ('$LOG'):"