Skip to content

Commit

Permalink
add start script retry
Browse files Browse the repository at this point in the history
  • Loading branch information
benja-wu committed Jul 30, 2021
1 parent 5df56c1 commit f2014ee
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions example/sbin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ fi
touch $stdfile
nohup $server "$@" --config-file $cfgfile >> $stdfile 2>&1 &

pid=`ps -eo pid,args | grep "$server" | grep -v grep | awk '{print $1}'`
if [ "$pid" = "" ]; then
echo "Error: failed to start $sever"
exit 2
fi
try_time=0
pid=""
while [ "$pid" = "" ]
do
sleep 3
pid=`ps -eo pid,args | grep "$server" | grep -v grep | awk '{print $1}'`
if [[ $try_time -ge 2 ]]; then
echo "Error: failed to start $sever"
exit 2
fi
done

popd > /dev/null

Expand Down

0 comments on commit f2014ee

Please sign in to comment.