summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavor <vorgrimmlerdavid@gmx.de>2012-08-09 17:09:16 +0200
committerdavor <vorgrimmlerdavid@gmx.de>2012-08-09 17:09:16 +0200
commite8a993812386e2ceeab822cfcc3679d10ca742c7 (patch)
tree2683365f296ce3b8310f6a9453058dc33a5080c5
parent4e899c8b2cb8f0562a4f81a6149d32900dadc305 (diff)
Added functions. Cleaned up.
-rw-r--r--ot-tools-user.sh97
1 files changed, 49 insertions, 48 deletions
diff --git a/ot-tools-user.sh b/ot-tools-user.sh
index 9e93b98..bc4a7d0 100644
--- a/ot-tools-user.sh
+++ b/ot-tools-user.sh
@@ -5,12 +5,22 @@ otconfig() {
source $HOME/.opentox/opentox-ui.sh
}
+
+# Start unicorn
+# @param1 [service_name]
+# @param2 integer Port
+# @example start_unicorn algorithm 8081
+start_unicorn() {
+ cd $HOME/opentox-ruby/$1
+ nice bash -c "nohup unicorn -p $2 >/dev/null 2>&1 &"
+}
+
# Start the server
otstart() {
if [ $# != 1 ]
then
echo "One argument required: [service_name] or 'all'"
- echo "usage: $0 [all|algorithm|compound|dataset|feature|model|task|validation|4store]"
+ echo "usage: otstart [all|algorithm|compound|dataset|feature|model|task|validation|4store]"
return 1
fi
@@ -19,36 +29,22 @@ otstart() {
DIR=`pwd`
case "$1" in
"algorithm")
- cd $HOME/opentox-ruby/$1;
- nice bash -c "nohup unicorn -p 8081 >/dev/null 2>&1 &";
- ;;
+ start_unicorn $1 8081;;
"compound")
- echo "$1 not available yet."
- #cd $HOME/opentox-ruby/$1;
- #nice bash -c "nohup unicorn -p 8082 >/dev/null 2>&1 &";
- ;;
+ echo "$1 not available yet.";;
+ #start_unicorn $1 8082;;
"dataset")
- cd $HOME/opentox-ruby/$1;
- nice bash -c "nohup unicorn -p 8083 >/dev/null 2>&1 &";
- ;;
+ start_unicorn $1 8083;;
"feature")
- cd $HOME/opentox-ruby/$1;
- nice bash -c "nohup unicorn -p 8084 >/dev/null 2>&1 &";
- ;;
+ start_unicorn $1 8084;;
"model")
- echo "$1 not available yet."
- #cd $HOME/opentox-ruby/$1;
- #nice bash -c "nohup unicorn -p 8085 >/dev/null 2>&1 &";
- ;;
+ echo "$1 not available yet.";;
+ #start_unicorn $1 8085;;
"task")
- cd $HOME/opentox-ruby/$1;
- nice bash -c "nohup unicorn -p 8086 >/dev/null 2>&1 &";
- ;;
+ start_unicorn $1 8086;;
"validation")
- echo "$1 not available yet."
- #cd $HOME/opentox-ruby/$1;
- #nice bash -c "nohup unicorn -p 8087 >/dev/null 2>&1 &";
- ;;
+ echo "$1 not available yet.";;
+ #start_unicorn $1 8087;;
"4store")
nice bash -c "nohup $HOME/opentox-ruby/4S/bin/4s-backend opentox >/dev/null 2>&1 &";
sleep 1;
@@ -64,6 +60,11 @@ otstart() {
otstart feature;
otstart task;
;;
+ *)
+ echo "One argument required: [service_name] or 'all'";
+ echo "usage: otstart [all|algorithm|compound|dataset|feature|model|task|validation|4store]";
+ return 1;
+ ;;
esac
cd $DIR
}
@@ -74,39 +75,34 @@ alias otless='less $HOME/.opentox/log/development.log'
# Tail log
alias ottail='tail -f $HOME/.opentox/log/development.log'
+# kill unicorn
+# @param1 integer Port
+# @example kill_unicorn 8081
+kill_unicorn() {
+ for p in `ps x | grep 'unicorn' | grep $1 | grep -v grep | awk '{print $1}'`; do kill -9 $p; done;
+}
+
# Kill the server
otkill() {
if [ $# != 1 ]
then
echo "One argument required: [service_name] or 'all'"
- echo "usage: $0 [all|algorithm|compound|dataset|feature|model|task|validation|4store]"
+ echo "usage: otkill [all|algorithm|compound|dataset|feature|model|task|validation|4store]"
return 1
fi
otconfig
case "$1" in
- "algorithm")
- for p in `ps x | grep 'unicorn' | grep 8081 | grep -v grep | awk '{print $1}'`; do kill -9 $p; done;
- ;;
- "compound")
- #for p in `ps x | grep 'unicorn' | grep 8082 | grep -v grep | awk '{print $1}'`; do kill -9 $p; done;
- ;;
- "dataset")
- for p in `ps x | grep 'unicorn' | grep 8083 | grep -v grep | awk '{print $1}'`; do kill -9 $p; done;
- ;;
- "feature")
- for p in `ps x | grep 'unicorn' | grep 8084 | grep -v grep | awk '{print $1}'`; do kill -9 $p; done;
- ;;
- "model")
- #for p in `ps x | grep 'unicorn' | grep 8085 | grep -v grep | awk '{print $1}'`; do kill -9 $p; done;
- ;;
- "task")
- for p in `ps x | grep 'unicorn' | grep 8086 | grep -v grep | awk '{print $1}'`; do kill -9 $p; done;
- ;;
- "validation")
- echo "$1 not available yet."
- #for p in `ps x | grep 'unicorn' | grep 8087 | grep -v grep | awk '{print $1}'`; do kill -9 $p; done;
- ;;
+ "algorithm") kill_unicorn 8081;;
+ "compound") #kill_unicorn 8082;;
+ echo "$1 not available yet.";;
+ "dataset") kill_unicorn 8083;;
+ "feature") kill_unicorn 8084;;
+ "model") #kill_unicorn 8085;;
+ echo "$1 not available yet.";;
+ "task") kill_unicorn 8086;;
+ "validation") #kill_unicorn 8087;;
+ echo "$1 not available yet.";;
"4store")
killall 4s-httpd >/dev/null 2>&1;
killall 4s-backend >/dev/null 2>&1;
@@ -121,5 +117,10 @@ otkill() {
#otkill validation;
otkill 4store;
;;
+ *)
+ echo "One argument required: [service_name] or 'all'";
+ echo "usage: otkill [all|algorithm|compound|dataset|feature|model|task|validation|4store]";
+ return 1;
+ ;;
esac
}