summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/lazar-start8
-rwxr-xr-xbin/lazar-start.sh8
-rwxr-xr-xbin/lazar-stop6
-rwxr-xr-xbin/lazar-stop.sh52
4 files changed, 74 insertions, 0 deletions
diff --git a/bin/lazar-start b/bin/lazar-start
new file mode 100755
index 0000000..73f6d91
--- /dev/null
+++ b/bin/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, '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/lazar-start.sh b/bin/lazar-start.sh
new file mode 100755
index 0000000..9072150
--- /dev/null
+++ b/bin/lazar-start.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+sudo mongod &
+R CMD Rserve
+LAZARPATH=$(gem path lazar-gui)
+cd $LAZARPATH
+unicorn -c unicorn.rb -E production -D
+
+exit 0
diff --git a/bin/lazar-stop b/bin/lazar-stop
new file mode 100755
index 0000000..67e72e9
--- /dev/null
+++ b/bin/lazar-stop
@@ -0,0 +1,6 @@
+#!/usr/bin/env ruby
+bin_dir = File.expand_path(File.dirname(__FILE__))
+shell_script_path = File.join(bin_dir, 'lazar-stop.sh')
+
+`#{shell_script_path}`
+
diff --git a/bin/lazar-stop.sh b/bin/lazar-stop.sh
new file mode 100755
index 0000000..eea6815
--- /dev/null
+++ b/bin/lazar-stop.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+grep_lazar=`ps aux | grep -v grep | grep 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 lazar-start | awk '{ print $1 }'`
+ for i in "${PID}"
+ do
+ `kill $i`
+ done
+else
+ echo "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