shell多进程脚本
Posted 道高一尺
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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
以上是关于shell多进程脚本的主要内容,如果未能解决你的问题,请参考以下文章