summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2016-05-12 10:21:50 +0000
committergebele <gebele@in-silico.ch>2016-05-12 10:21:50 +0000
commit171d6e675a0e1c209340d2988e3a39d06999d18c (patch)
treed30c569bc3cbf24e6dd3da7d1a9e5092585c6e38
parentb0104928c6b8d92c8980dcf42c6c32450fc63c1b (diff)
added start and stop script
-rw-r--r--Gemfile2
-rw-r--r--application.rb4
-rwxr-xr-x[-rw-r--r--]bin/lazar-start (renamed from bin/lazar)2
-rwxr-xr-xbin/lazar-start.sh20
-rwxr-xr-xbin/lazar-stop6
-rwxr-xr-xbin/lazar-stop.sh24
-rwxr-xr-xbin/lazar.sh3
-rw-r--r--lazar-gui.gemspec6
8 files changed, 59 insertions, 8 deletions
diff --git a/Gemfile b/Gemfile
index fbd485e..775c2c4 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,6 @@
source "https://rubygems.org"
gemspec
+gem "lazar"
gem "sinatra"
gem "haml"
gem "sass"
-gem "lazar"
diff --git a/application.rb b/application.rb
index 7b774bc..1fa0663 100644
--- a/application.rb
+++ b/application.rb
@@ -1,5 +1,5 @@
-require_relative 'helper.rb'
-require 'rdiscount'
+#require_relative 'helper.rb'
+#require 'rdiscount'
include OpenTox
#require File.join(ENV["HOME"],".opentox","config","lazar-gui.rb") # until added to ot-tools
diff --git a/bin/lazar b/bin/lazar-start
index 0fd2895..713acf2 100644..100755
--- a/bin/lazar
+++ b/bin/lazar-start
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
bin_dir = File.expand_path(File.dirname(__FILE__))
-shell_script_path = File.join(bin_dir, 'lazar.sh')
+shell_script_path = File.join(bin_dir, 'lazar-start.sh')
`#{shell_script_path}`
diff --git a/bin/lazar-start.sh b/bin/lazar-start.sh
new file mode 100755
index 0000000..b1ea61c
--- /dev/null
+++ b/bin/lazar-start.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+#R CMD Rserve
+#sudo mongod
+#unicorn -p 8088 -E production
+
+RETVAL=0
+
+start() {
+ grep_mongo=`ps aux | grep -v grep | grep mongod`
+ if [ ${#grep_mongo} -gt 0 ]
+ then
+ echo "MongoDB is already running."
+ else
+ echo "Start MongoDB."
+ `sudo mongod`
+ RETVAL=$?
+ fi
+}
+
+exit $RETVAL
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..26de413
--- /dev/null
+++ b/bin/lazar-stop.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+#R CMD Rserve
+#sudo mongod
+#unicorn -p 8088 -E production
+
+RETVAL=0
+
+stop() {
+ grep_mongo=`ps aux | grep -v grep | grep mongod`
+ if [ ${#grep_mongo} -gt 0 ]
+ then
+ echo "Stop MongoDB."
+ PID=`ps ax | grep -v grep | grep mongod | awk '{ print $1 }'`
+ for i in "${PID}"
+ do
+ `sudo kill -2 $i`
+ done
+ RETVAL=$?
+ else
+ echo "MongoDB is not running."
+ fi
+}
+
+exit $RETVAL
diff --git a/bin/lazar.sh b/bin/lazar.sh
deleted file mode 100755
index 28d70a7..0000000
--- a/bin/lazar.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-sudo /usr/bin/mongod &
-unicorn -p 8088 -E production &
diff --git a/lazar-gui.gemspec b/lazar-gui.gemspec
index 0f61cb2..9eec5f4 100644
--- a/lazar-gui.gemspec
+++ b/lazar-gui.gemspec
@@ -15,8 +15,12 @@ Gem::Specification.new do |s|
s.add_runtime_dependency "lazar", "~> 0.9.3"
s.add_runtime_dependency "sinatra", "~> 1.4.0"
- s.add_runtime_dependency "rdiscount", "~> 2.1.0"
+ s.add_runtime_dependency "rdiscount", "~> 2.1.0"
s.add_runtime_dependency "haml", "~> 4.0.0"
s.add_runtime_dependency "sass", "~> 3.4.0"
s.add_runtime_dependency "unicorn", "~> 5.1.0"
+
+ s.post_install_message = %q{
+ To run the service execute `lazar &`.
+ }
end