You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
riskcloudmock/run.sh

35 lines
493 B

4 years ago
#!/bin/sh
4 years ago
function run(){
nohup yarn start &
4 years ago
4 years ago
while true
4 years ago
do
pid=`findPortPid $webPort`
4 years ago
if [ $pid ]
4 years ago
then
echo "pid is $pid"
break
4 years ago
else
echo pid not found!!!
sleep 1s
4 years ago
done
4 years ago
4 years ago
touch $pid.log && chmod +x $pid.log
4 years ago
}
4 years ago
if [ -e *.log ]
4 years ago
then
4 years ago
pid=`stat *.log|awk 'NR>1{next}{c=$0;gsub(/\D/,"",c);print c}'`
4 years ago
kill -9 $pid
4 years ago
if [ $? -eq 0 ]
then
4 years ago
echo "kill $pid success"
4 years ago
rm -f *.log
4 years ago
run
4 years ago
else
4 years ago
echo "kill $pid error"
4 years ago
fi
4 years ago
else
4 years ago
run
4 years ago
fi