-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,41 @@ | ||
#!/bin/bash | ||
|
||
# 判断进程是否正在运行 | ||
isProcessRunning() { | ||
pid=`ps ax | grep "$PROG_PATH/$PROG" | grep -v "grep" | awk '{print $1}'` | ||
if [[ $pid != "" ]] ; then | ||
echo "true" | ||
return "$?" | ||
else | ||
echo "false" | ||
return "$?" | ||
fi | ||
} | ||
|
||
set -e | ||
|
||
#Launch the gateway | ||
if [[ $APINTO_DEBUG == "true" ]]; then | ||
#Launch the gateway | ||
./apinto start | ||
echo "[$(date "+%Y-%m-%d %H:%M:%S")] Gateway Stop" | ||
exit 0 | ||
fi | ||
|
||
is_process_running=$(isProcessRunning) | ||
if [[ "$is_process_running" = "true" ]] ; then | ||
echo "[$(date "+%Y-%m-%d %H:%M:%S")] process still running, waiting..." | ||
sleep 5s | ||
fi | ||
|
||
./apinto start | ||
is_process_running=$(isProcessRunning) | ||
if [[ "$is_process_running" = "true" ]] ; then | ||
echo "[$(date "+%Y-%m-%d %H:%M:%S")] APINTO start Success!" >> a.out | ||
tail -f a.out | ||
echo "[$(date "+%Y-%m-%d %H:%M:%S")] Gateway Stop" | ||
exit 0 | ||
else | ||
echo "[$(date "+%Y-%m-%d %H:%M:%S")] APINTO start Failed!" >> a.out | ||
fi | ||
|
||
|
||
echo "APINTO start Success!" >> a.out | ||
tail -f a.out |