Permalink
Browse files

nginx

  • Loading branch information...
1 parent b9c41b2 commit dcb4efc8ea50b1ffe59003d2d27cdd270ad3adc6 Philip MacIver committed Apr 9, 2012
Showing with 12 additions and 12 deletions.
  1. +6 −6 bin/elasticsearch.erb
  2. +6 −6 bin/nginx.erb
View
@@ -3,11 +3,11 @@
DAEMON=elasticsearch
function check_process {
- pgrep -f elasticsearch &>/dev/null
+ test -r /var/run/$DAEMON.pid
}
case "$1" in
- start)
+start)
echo "Starting $DAEMON"
check_process
[[ "$?" != "0" ]] && /opt/elasticsearch/bin/elasticsearch -p /var/run/$DAEMON.pid
@@ -20,7 +20,7 @@ case "$1" in
exit 1
fi
;;
- stop)
+stop)
echo "Stopping $DAEMON"
check_process
[[ "$?" = "0" ]] && kill `cat /var/run/$DAEMON.pid` &>/dev/null
@@ -32,11 +32,11 @@ case "$1" in
echo "Failed to stop $DAEMON"
fi
;;
- restart)
+restart)
$0 stop
sleep 1
$0 start
;;
- *)
- echo "usage: $0 {start|stop|restart}"
+*)
+ echo "usage: $0 {start|stop|restart}"
esac
View
@@ -3,11 +3,11 @@
DAEMON=nginx
function check_process {
- pgrep nginx &>/dev/null
+ test -r /opt/nginx/run/$DAEMON.pid
}
case "$1" in
- start)
+start)
echo "Starting $DAEMON"
check_process
[[ "$?" != "0" ]] && /opt/nginx/sbin/nginx
@@ -20,7 +20,7 @@ case "$1" in
exit 1
fi
;;
- stop)
+stop)
echo "Stopping $DAEMON"
check_process
[[ "$?" = "0" ]] && kill `cat /opt/nginx/run/$DAEMON.pid` &>/dev/null
@@ -32,11 +32,11 @@ case "$1" in
echo "Failed to stop $DAEMON"
fi
;;
- restart)
+restart)
$0 stop
sleep 1
$0 start
;;
- *)
- echo "usage: $0 {start|stop|restart}"
+*)
+ echo "usage: $0 {start|stop|restart}"
esac

0 comments on commit dcb4efc

Please sign in to comment.