shell多进程脚本
#!/bin/bash python_path=/home/huaw/crawler python_name=list_all_v6_crawler.py MAX_SYNC_PROCESS=40 echo "max allowed ic_stat_company_submit process is $MAX_SYNC_PROCESS" current_sync_num=`ps -ef|grep $python_name | wc -l |grep -v grep` current_sync_num=$[current_sync_num-1] echo "current started ic_stat_company_submit process count $current_sync_num" if [ $current_sync_num -lt $MAX_SYNC_PROCESS ] then sync_num=$[ MAX_SYNC_PROCESS-current_sync_num] echo "not reach max processes,will start $sync_num process..." for((i=1;i<=$sync_num;i++));do echo "process will be started..." cd $python_path python $python_name >> list.log 2>&1 & done else echo "runing....." fi
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步