mirror of https://github.com/apache/jclouds.git
don't exit unless process has already started
This commit is contained in:
parent
712d50dea8
commit
0b4347772b
|
@ -9,7 +9,7 @@ function forget {
|
||||||
local LOG_DIR="$1"; shift
|
local LOG_DIR="$1"; shift
|
||||||
mkdir -p $LOG_DIR
|
mkdir -p $LOG_DIR
|
||||||
findPid $INSTANCE_NAME
|
findPid $INSTANCE_NAME
|
||||||
[ -n "$FOUND_PID" ] && {
|
[ -n "$FOUND_PID" -a -f $LOG_DIR/stdout.log ] && {
|
||||||
echo $INSTANCE_NAME already running pid [$FOUND_PID]
|
echo $INSTANCE_NAME already running pid [$FOUND_PID]
|
||||||
} || {
|
} || {
|
||||||
nohup $SCRIPT >$LOG_DIR/stdout.log 2>$LOG_DIR/stderr.log &
|
nohup $SCRIPT >$LOG_DIR/stdout.log 2>$LOG_DIR/stderr.log &
|
||||||
|
|
|
@ -26,7 +26,7 @@ function findPid {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
local PATTERN="$1"; shift
|
local PATTERN="$1"; shift
|
||||||
local _FOUND=`ps auxwww|grep "$PATTERN"|grep -v " $0"|grep -v grep|awk '{print $2}'`
|
local _FOUND=`ps auxwww|grep "$PATTERN"|grep -v " $0"|grep -v grep|grep -v $$|awk '{print $2}'`
|
||||||
[ -n "$_FOUND" ] && {
|
[ -n "$_FOUND" ] && {
|
||||||
export FOUND_PID=$_FOUND
|
export FOUND_PID=$_FOUND
|
||||||
return 0
|
return 0
|
||||||
|
@ -45,7 +45,7 @@ function forget {
|
||||||
local LOG_DIR="$1"; shift
|
local LOG_DIR="$1"; shift
|
||||||
mkdir -p $LOG_DIR
|
mkdir -p $LOG_DIR
|
||||||
findPid $INSTANCE_NAME
|
findPid $INSTANCE_NAME
|
||||||
[ -n "$FOUND_PID" ] && {
|
[ -n "$FOUND_PID" -a -f $LOG_DIR/stdout.log ] && {
|
||||||
echo $INSTANCE_NAME already running pid [$FOUND_PID]
|
echo $INSTANCE_NAME already running pid [$FOUND_PID]
|
||||||
} || {
|
} || {
|
||||||
nohup $SCRIPT >$LOG_DIR/stdout.log 2>$LOG_DIR/stderr.log &
|
nohup $SCRIPT >$LOG_DIR/stdout.log 2>$LOG_DIR/stderr.log &
|
||||||
|
|
|
@ -24,7 +24,7 @@ function findPid {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
local PATTERN="$1"; shift
|
local PATTERN="$1"; shift
|
||||||
local _FOUND=`ps auxwww|grep "$PATTERN"|grep -v " $0"|grep -v grep|awk '{print $2}'`
|
local _FOUND=`ps auxwww|grep "$PATTERN"|grep -v " $0"|grep -v grep|grep -v $$|awk '{print $2}'`
|
||||||
[ -n "$_FOUND" ] && {
|
[ -n "$_FOUND" ] && {
|
||||||
export FOUND_PID=$_FOUND
|
export FOUND_PID=$_FOUND
|
||||||
return 0
|
return 0
|
||||||
|
@ -43,7 +43,7 @@ function forget {
|
||||||
local LOG_DIR="$1"; shift
|
local LOG_DIR="$1"; shift
|
||||||
mkdir -p $LOG_DIR
|
mkdir -p $LOG_DIR
|
||||||
findPid $INSTANCE_NAME
|
findPid $INSTANCE_NAME
|
||||||
[ -n "$FOUND_PID" ] && {
|
[ -n "$FOUND_PID" -a -f $LOG_DIR/stdout.log ] && {
|
||||||
echo $INSTANCE_NAME already running pid [$FOUND_PID]
|
echo $INSTANCE_NAME already running pid [$FOUND_PID]
|
||||||
} || {
|
} || {
|
||||||
nohup $SCRIPT >$LOG_DIR/stdout.log 2>$LOG_DIR/stderr.log &
|
nohup $SCRIPT >$LOG_DIR/stdout.log 2>$LOG_DIR/stderr.log &
|
||||||
|
|
|
@ -14,7 +14,7 @@ function findPid {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
local PATTERN="$1"; shift
|
local PATTERN="$1"; shift
|
||||||
local _FOUND=`ps auxwww|grep "$PATTERN"|grep -v " $0"|grep -v grep|awk '{print $2}'`
|
local _FOUND=`ps auxwww|grep "$PATTERN"|grep -v " $0"|grep -v grep|grep -v $$|awk '{print $2}'`
|
||||||
[ -n "$_FOUND" ] && {
|
[ -n "$_FOUND" ] && {
|
||||||
export FOUND_PID=$_FOUND
|
export FOUND_PID=$_FOUND
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Reference in New Issue