Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ncdc committed Nov 26, 2013
0 parents commit 47f542a
Show file tree
Hide file tree
Showing 35 changed files with 840 additions and 0 deletions.
73 changes: 73 additions & 0 deletions bin/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/bash -e

PID_FILE=$OPENSHIFT_ELASTICSEARCH_DIR/run/elasticsearch.pid

function _is_running() {
if [ -f $PID_FILE ]; then
zpid=$(cat $PID_FILE 2> /dev/null)
myid=$(id -u)
if `ps -opid,args --pid $zpid 2>&1 &> /dev/null`; then
return 0
fi
fi

return 1
}

function start() {
if _is_running; then
echo "ElasticSearch is already running" 1>&2
return 0
fi

$OPENSHIFT_ELASTICSEARCH_DIR/usr/bin/elasticsearch -p $PID_FILE
}

function stop() {
if ! _is_running; then
echo "ElasticSearch is already stopped" 1>&2
return 0
fi

if [ -f $PID_FILE ]; then
zpid=$(cat $PID_FILE 2> /dev/null)
fi

if [ -n $zpid ]; then
/bin/kill $zpid
ret=$?
if [ $ret -eq 0 ]; then
TIMEOUT=10
while [ $TIMEOUT -gt 0 ] && _is_running ; do
/bin/kill -0 "$zpid" > /dev/null 2>&1 || break
sleep 1
let TIMEOUT=${TIMEOUT}-1
done
fi
fi
}

function restart() {
stop
start
}

function status() {
if output=$(curl http://$OPENSHIFT_RUBY_IP:$OPENSHIFT_RUBY_PORT/ &> /dev/null); then
client_result "Application is running"
else
client_result "Application is either stopped or inaccessible"
fi
}

function threaddump() {
}

case "$1" in
start) start ;;
stop) stop ;;
restart | reload ) restart $1 ;;
status) status ;;
threaddump) threaddump ;;
*) exit 0
esac
3 changes: 3 additions & 0 deletions bin/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash -e

mkdir -p $OPENSHIFT_ELASTICSEARCH_DIR/run $OPENSHIFT_DATA_DIR/elasticsearch
Empty file added bin/setup
Empty file.
12 changes: 12 additions & 0 deletions bin/tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /[email protected]/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.8 //
_is_running /Users/andy/Dropbox/openshift/openshift-elasticsearch-cartridge/bin/control /^function _is_running() {$/;" f language:Sh
restart /Users/andy/Dropbox/openshift/openshift-elasticsearch-cartridge/bin/control /^function restart() {$/;" f language:Sh
start /Users/andy/Dropbox/openshift/openshift-elasticsearch-cartridge/bin/control /^function start() {$/;" f language:Sh
status /Users/andy/Dropbox/openshift/openshift-elasticsearch-cartridge/bin/control /^function status() {$/;" f language:Sh
stop /Users/andy/Dropbox/openshift/openshift-elasticsearch-cartridge/bin/control /^function stop() {$/;" f language:Sh
threaddump /Users/andy/Dropbox/openshift/openshift-elasticsearch-cartridge/bin/control /^function threaddump() {$/;" f language:Sh
Loading

0 comments on commit 47f542a

Please sign in to comment.