From 171d6e675a0e1c209340d2988e3a39d06999d18c Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 12 May 2016 10:21:50 +0000 Subject: added start and stop script --- bin/lazar | 5 ----- bin/lazar-start | 5 +++++ bin/lazar-start.sh | 20 ++++++++++++++++++++ bin/lazar-stop | 6 ++++++ bin/lazar-stop.sh | 24 ++++++++++++++++++++++++ bin/lazar.sh | 3 --- 6 files changed, 55 insertions(+), 8 deletions(-) delete mode 100644 bin/lazar create mode 100755 bin/lazar-start create mode 100755 bin/lazar-start.sh create mode 100755 bin/lazar-stop create mode 100755 bin/lazar-stop.sh delete mode 100755 bin/lazar.sh (limited to 'bin') diff --git a/bin/lazar b/bin/lazar deleted file mode 100644 index 0fd2895..0000000 --- a/bin/lazar +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env ruby -bin_dir = File.expand_path(File.dirname(__FILE__)) -shell_script_path = File.join(bin_dir, 'lazar.sh') - -`#{shell_script_path}` diff --git a/bin/lazar-start b/bin/lazar-start new file mode 100755 index 0000000..713acf2 --- /dev/null +++ b/bin/lazar-start @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby +bin_dir = File.expand_path(File.dirname(__FILE__)) +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 & -- cgit v1.2.3