summaryrefslogtreecommitdiff
path: root/ot-tools-user.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ot-tools-user.sh')
-rw-r--r--ot-tools-user.sh65
1 files changed, 40 insertions, 25 deletions
diff --git a/ot-tools-user.sh b/ot-tools-user.sh
index ca3bdbd..d60a26e 100644
--- a/ot-tools-user.sh
+++ b/ot-tools-user.sh
@@ -3,6 +3,7 @@
# Load server config
otconfig() {
source $HOME/.opentox/opentox-ui.sh
+ source $HOME/.opentox/config/install/config.sh
}
# Display log
@@ -20,6 +21,18 @@ start_unicorn() {
nice bash -c "nohup unicorn -p $2 >/dev/null 2>&1 &"
}
+# Start unicorn
+# @param1 [backend_name]
+# @param2 integer Port
+# @example start_unicorn algorithm 8081
+start_4s() {
+ nice bash -c "nohup $OT_PREFIX/4S/bin/4s-backend $1 >/dev/null 2>&1 &";
+ sleep 0.5;
+ nice bash -c "nohup $OT_PREFIX/4S/bin/4s-httpd -H localhost -p $2 -s -1 $1 >/dev/null 2>&1 &"; #-D for testing
+ sleep 0.5;
+
+}
+
# Start the server
otstart() {
if [ $# != 1 ]
@@ -33,25 +46,28 @@ otstart() {
otkill $1
DIR=`pwd`
case "$1" in
- "algorithm") start_unicorn $1 8081;;
- "compound") #start_unicorn $1 8082;;
+ "algorithm") start_4s $1 9081;
+ start_unicorn $1 8081;;
+ "compound") start_4s $1 9082;
+ start_unicorn $1 8082;;
+ "dataset") start_4s $1 9083;
+ start_unicorn $1 8083;;
+ "feature") start_4s $1 9084;
+ start_unicorn $1 8084;;
+ "model") #start_4s $1 9085;
+ #start_unicorn $1 8085;;
echo "$1 not available yet.";;
- "dataset") start_unicorn $1 8083;;
- "feature") start_unicorn $1 8084;;
- "model") #start_unicorn $1 8085;;
+ "task") start_4s $1 9086;
+ start_unicorn $1 8086;;
+ "validation") #start_4s $1 9087;
+ #start_unicorn $1 8087;;
echo "$1 not available yet.";;
- "task") start_unicorn $1 8086;;
- "validation") #start_unicorn $1 8087;;
- echo "$1 not available yet.";;
- "4store") nice bash -c "nohup $HOME/opentox-ruby/4S/bin/4s-backend opentox >/dev/null 2>&1 &";
- sleep 1;
- nice bash -c "nohup $HOME/opentox-ruby/4S/bin/4s-httpd -D -H localhost -p 8088 opentox >/dev/null 2>&1 &";
- sleep 1;
- if ! pgrep -u $USER 4s-backend>/dev/null 2>&1; then echo "Failed to start 4s-backend."; fi
- if ! pgrep -u $USER 4s-httpd>/dev/null 2>&1; then echo "Failed to start 4s-httpd."; fi;;
+ "4store") start_4s opentox 9088;;
+ #if ! pgrep -u $USER 4s-backend>/dev/null 2>&1; then echo "Failed to start 4s-backend."; fi
+ #if ! pgrep -u $USER 4s-httpd>/dev/null 2>&1; then echo "Failed to start 4s-httpd."; fi;;
"all") otstart 4store;
otstart algorithm;
- #otstart compound;
+ otstart compound;
otstart dataset;
otstart feature;
#otstart model;
@@ -61,6 +77,7 @@ otstart() {
echo "usage: otstart [all|algorithm|compound|dataset|feature|model|task|validation|4store]";
return 1;;
esac
+ sleep 1
cd $DIR
}
@@ -94,8 +111,7 @@ otreload() {
otconfig
case "$1" in
"algorithm") reload_unicorn 8081;;
- "compound") #reload_unicorn 8082;;
- echo "$1 not available yet.";;
+ "compound") reload_unicorn 8082;;
"dataset") reload_unicorn 8083;;
"feature") reload_unicorn 8084;;
"model") #reload_unicorn 8085;;
@@ -107,7 +123,7 @@ otreload() {
#killall 4s-backend >/dev/null 2>&1;;
echo "$1 reload not available yet.";;
"all") otreload algorithm;
- #otreload compound;
+ otreload compound;
otreload dataset;
otreload feature;
#otreload model;
@@ -118,6 +134,7 @@ otreload() {
echo "usage: otreload [all|algorithm|compound|dataset|feature|model|task|validation|4store]";
return 1;;
esac
+ sleep 1
}
# kill unicorn
@@ -139,8 +156,7 @@ otkill() {
otconfig
case "$1" in
"algorithm") kill_unicorn 8081;;
- "compound") #kill_unicorn 8082;;
- echo "$1 not available yet.";;
+ "compound") kill_unicorn 8082;;
"dataset") kill_unicorn 8083;;
"feature") kill_unicorn 8084;;
"model") #kill_unicorn 8085;;
@@ -151,7 +167,7 @@ otkill() {
"4store") killall 4s-httpd >/dev/null 2>&1;
killall 4s-backend >/dev/null 2>&1;;
"all") otkill algorithm;
- #otkill compound;
+ otkill compound;
otkill dataset;
otkill feature;
#otkill model;
@@ -162,6 +178,7 @@ otkill() {
echo "usage: otkill [all|algorithm|compound|dataset|feature|model|task|validation|4store]";
return 1;;
esac
+ sleep 1
}
# get service uri
@@ -232,8 +249,7 @@ otcheck() {
otconfig
case "$1" in
"algorithm") check_service "algorithm";;
- "compound") #check_service "compound";;
- echo "$1 not available yet.";;
+ "compound") check_service "compound";;
"dataset") check_service "dataset";;
"feature") check_service "feature";;
"model") #check_service "model";;
@@ -242,9 +258,8 @@ otcheck() {
"validation") #check_service "validation";;
echo "$1 not available yet.";;
"4store") check_service "four_store";;
- #killall 4s-backend >/dev/null 2>&1;;
"all") otcheck "algorithm";
- #otcheck "compound";
+ otcheck "compound";
otcheck "dataset";
otcheck "feature";
#otcheck "model";