diff options
author | Andreas Maunz <andreas@maunz.de> | 2011-05-24 11:29:16 +0200 |
---|---|---|
committer | Andreas Maunz <andreas@maunz.de> | 2011-05-24 11:29:16 +0200 |
commit | 0a15ffb5f287956fd551cc0d4628b2f5fc04bef7 (patch) | |
tree | d492e1a1be3b8509840544b8ca296b88955f10fe | |
parent | 292d6f3459737d3b20d88a71cfb820d15d9ff0ca (diff) | |
parent | 22eec6d44e20612bf75ec0843e8d53de6783ec9f (diff) |
Merge branch 'development' of github.com:opentox/install into development
-rw-r--r-- | environment_update.sh | 77 |
1 files changed, 77 insertions, 0 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." |