#!/bin/bash export LOG_FILE='/data/log/search' spider_search_pid=`ps aux|grep flask_web_search|grep -v "grep"|awk '{print $2}'` if [ "$spider_search_pid" ];then ps aux|grep flask_web_search|grep -v "grep"|awk '{print $2}'|xargs kill -9 echo "old spider search process is killed" fi cd /data/spider-search/ for port in 5001 5555 5556 5557 do file_search='flask_web_search.py' log_file='/data/log/web'$port'.log' echo $port nohup /usr/bin/python3 $file_search $port >$log_file 2>&1 & done sleep 5 spider_search_port01=` netstat -lntp|grep "5001"|awk '{print $4}'|awk -F":" '{print $2}'` echo $spider_search_port01 if [ "$spider_search_port01" ];then echo -e "