From b5f9186a72cb2dc107e65e5d50baa57d42f7658d Mon Sep 17 00:00:00 2001 From: Andreas Maunz Date: Thu, 24 May 2012 11:18:36 +0200 Subject: Added otcheck and nice --- ot-tools-user.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ot-tools-user.sh b/ot-tools-user.sh index 57c6c00..b002db6 100644 --- a/ot-tools-user.sh +++ b/ot-tools-user.sh @@ -52,8 +52,8 @@ otupdate() { otstart() { otconfig otkill - bash -c "nohup redis-server $HOME/opentox-ruby/redis-*/redis.conf >/dev/null 2>&1 &" - bash -c "nohup nginx -c $HOME/opentox-ruby/nginx/conf/nginx.conf >/dev/null 2>&1 &" + nice bash -c "nohup redis-server $HOME/opentox-ruby/redis-*/redis.conf >/dev/null 2>&1 &" + nice bash -c "nohup nginx -c $HOME/opentox-ruby/nginx/conf/nginx.conf >/dev/null 2>&1 &" sleep 2 if ! pgrep -u $USER nginx>/dev/null 2>&1; then echo "Failed to start nginx."; fi if ! pgrep -u $USER redis-server>/dev/null 2>&1; then echo "Failed to start redis."; fi @@ -81,3 +81,11 @@ otkill() { for p in `pgrep -u $USER R 2>/dev/null`; do kill -9 $p; done } +# Check the server +otcheck() { + check_service=`cat $HOME/.opentox/config/production.yaml | grep opentox-algorithm | sed 's/.*\s//g' | sed 's/"//g'` + if [ -z "`curl -v $check_service 2>&1 | grep '200 OK'`" ]; then + otstart + fi +} + -- cgit v1.2.3