summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2016-10-31 16:09:18 +0000
committergebele <gebele@in-silico.ch>2016-10-31 16:09:18 +0000
commit678a9e60be4a9a6b0c59969a0f6e0266885337fa (patch)
tree7e16ae9ce6e5946d250d9be9031ec6f4b520e9a4 /bin
parentd05b5b91249a846b68c755d3716abc7343670a2a (diff)
updated README; added service commands for the gem
Diffstat (limited to 'bin')
-rw-r--r--bin/nano-lazar-start8
-rw-r--r--bin/nano-lazar-start.sh8
-rw-r--r--bin/nano-lazar-stop5
-rw-r--r--bin/nano-lazar-stop.sh52
4 files changed, 73 insertions, 0 deletions
diff --git a/bin/nano-lazar-start b/bin/nano-lazar-start
new file mode 100644
index 0000000..0cbaba5
--- /dev/null
+++ b/bin/nano-lazar-start
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+bin_dir = File.expand_path(File.dirname(__FILE__))
+shell_script_path = File.join(bin_dir, 'nano-lazar-start.sh')
+app_dir = File.expand_path('..')
+unicorn_conf = File.join(app_dir, 'unicorn.rb')
+
+`#{shell_script_path}`
+`#{unicorn_conf}`
diff --git a/bin/nano-lazar-start.sh b/bin/nano-lazar-start.sh
new file mode 100644
index 0000000..f772c66
--- /dev/null
+++ b/bin/nano-lazar-start.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+sudo mongod &
+R CMD Rserve
+GEMPATH=$(gem path nano-lazar)
+cd $GEMPATH
+unicorn -c unicorn.rb -E production -D
+
+exit 0
diff --git a/bin/nano-lazar-stop b/bin/nano-lazar-stop
new file mode 100644
index 0000000..b3ef727
--- /dev/null
+++ b/bin/nano-lazar-stop
@@ -0,0 +1,5 @@
+#!/usr/bin/env ruby
+bin_dir = File.expand_path(File.dirname(__FILE__))
+shell_script_path = File.join(bin_dir, 'nano-lazar-stop.sh')
+
+`#{shell_script_path}`
diff --git a/bin/nano-lazar-stop.sh b/bin/nano-lazar-stop.sh
new file mode 100644
index 0000000..ec91982
--- /dev/null
+++ b/bin/nano-lazar-stop.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+grep_nano_lazar=`ps aux | grep -v grep | grep nano-lazar-start`
+grep_mongo=`ps aux | grep -v grep | grep mongod`
+grep_rserve=`ps aux | grep -v grep | grep Rserve`
+grep_unicorn=`ps aux | grep -v grep | grep unicorn`
+
+# lazar
+if [ ${#grep_lazar} -gt 0 ]
+then
+ PID=`ps ax | grep -v grep | grep nano-lazar-start | awk '{ print $1 }'`
+ for i in "${PID}"
+ do
+ `kill $i`
+ done
+else
+ echo "nano-lazar is stopped."
+fi
+
+# mongod
+if [ ${#grep_mongo} -gt 0 ]
+then
+ PID=`ps ax | grep -v grep | grep mongod | awk '{ print $1 }'`
+ for i in "${PID}"
+ do
+ `sudo kill $i`
+ done
+else
+ echo "MongoDB is not running."
+fi
+
+# rserve
+if [ ${#grep_rserve} -gt 0 ]
+then
+ PID=`ps ax | grep -v grep | grep Rserve | awk '{ print $1 }'`
+ for i in "${PID}"
+ do
+ `kill $i`
+ done
+else
+ echo "Rserve is not running."
+fi
+
+# unicorn
+if [ ${#grep_unicorn} -gt 0 ]
+then
+ PID=`ps ax | grep -v grep | grep unicorn | awk '{ print $1 }'`
+ `kill ${PID[0]}`
+else
+ echo "Unicorn is not running."
+fi
+
+exit 0