Browse Source

HADOOP-360. Use 'kill -0' instead of 'ps -p' to check if process is
alive, for better compatibility with cygwin. Contributed by Philippe
Gassmann.


git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@421248 13f79535-47bb-0310-9956-ffa450edef68

Doug Cutting 19 years ago
parent
commit
84c816cf51
1 changed files with 2 additions and 2 deletions
  1. 2 2
      bin/hadoop-daemon.sh

+ 2 - 2
bin/hadoop-daemon.sh

@@ -72,7 +72,7 @@ case $startStop in
   (start)
 
     if [ -f $pid ]; then
-      if ps -p `cat $pid` > /dev/null 2>&1; then
+      if kill -0 `cat $pid` > /dev/null 2>&1; then
         echo $command running as process `cat $pid`.  Stop it first.
         exit 1
       fi
@@ -92,7 +92,7 @@ case $startStop in
   (stop)
 
     if [ -f $pid ]; then
-      if ps -p `cat $pid` > /dev/null 2>&1; then
+      if kill -0 `cat $pid` > /dev/null 2>&1; then
         echo stopping $command
         kill `cat $pid`
       else