瀏覽代碼

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 年之前
父節點
當前提交
84c816cf51
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      bin/hadoop-daemon.sh

+ 2 - 2
bin/hadoop-daemon.sh

@@ -72,7 +72,7 @@ case $startStop in
   (start)
   (start)
 
 
     if [ -f $pid ]; then
     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.
         echo $command running as process `cat $pid`.  Stop it first.
         exit 1
         exit 1
       fi
       fi
@@ -92,7 +92,7 @@ case $startStop in
   (stop)
   (stop)
 
 
     if [ -f $pid ]; then
     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
         echo stopping $command
         kill `cat $pid`
         kill `cat $pid`
       else
       else