Skip to content

Commit

Permalink
nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip MacIver committed Apr 9, 2012
1 parent b9c41b2 commit dcb4efc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions bin/elasticsearch.erb
Expand Up @@ -3,11 +3,11 @@
DAEMON=elasticsearch DAEMON=elasticsearch


function check_process { function check_process {
pgrep -f elasticsearch &>/dev/null test -r /var/run/$DAEMON.pid
} }


case "$1" in case "$1" in
start) start)
echo "Starting $DAEMON" echo "Starting $DAEMON"
check_process check_process
[[ "$?" != "0" ]] && /opt/elasticsearch/bin/elasticsearch -p /var/run/$DAEMON.pid [[ "$?" != "0" ]] && /opt/elasticsearch/bin/elasticsearch -p /var/run/$DAEMON.pid
Expand All @@ -20,7 +20,7 @@ case "$1" in
exit 1 exit 1
fi fi
;; ;;
stop) stop)
echo "Stopping $DAEMON" echo "Stopping $DAEMON"
check_process check_process
[[ "$?" = "0" ]] && kill `cat /var/run/$DAEMON.pid` &>/dev/null [[ "$?" = "0" ]] && kill `cat /var/run/$DAEMON.pid` &>/dev/null
Expand All @@ -32,11 +32,11 @@ case "$1" in
echo "Failed to stop $DAEMON" echo "Failed to stop $DAEMON"
fi fi
;; ;;
restart) restart)
$0 stop $0 stop
sleep 1 sleep 1
$0 start $0 start
;; ;;
*) *)
echo "usage: $0 {start|stop|restart}" echo "usage: $0 {start|stop|restart}"
esac esac
12 changes: 6 additions & 6 deletions bin/nginx.erb
Expand Up @@ -3,11 +3,11 @@
DAEMON=nginx DAEMON=nginx


function check_process { function check_process {
pgrep nginx &>/dev/null test -r /opt/nginx/run/$DAEMON.pid
} }


case "$1" in case "$1" in
start) start)
echo "Starting $DAEMON" echo "Starting $DAEMON"
check_process check_process
[[ "$?" != "0" ]] && /opt/nginx/sbin/nginx [[ "$?" != "0" ]] && /opt/nginx/sbin/nginx
Expand All @@ -20,7 +20,7 @@ case "$1" in
exit 1 exit 1
fi fi
;; ;;
stop) stop)
echo "Stopping $DAEMON" echo "Stopping $DAEMON"
check_process check_process
[[ "$?" = "0" ]] && kill `cat /opt/nginx/run/$DAEMON.pid` &>/dev/null [[ "$?" = "0" ]] && kill `cat /opt/nginx/run/$DAEMON.pid` &>/dev/null
Expand All @@ -32,11 +32,11 @@ case "$1" in
echo "Failed to stop $DAEMON" echo "Failed to stop $DAEMON"
fi fi
;; ;;
restart) restart)
$0 stop $0 stop
sleep 1 sleep 1
$0 start $0 start
;; ;;
*) *)
echo "usage: $0 {start|stop|restart}" echo "usage: $0 {start|stop|restart}"
esac esac

0 comments on commit dcb4efc

Please sign in to comment.