首页 > 系统服务 > 详细

shell多进程脚本

时间:2017-11-27 19:51:06      阅读:131      评论:0      收藏:0      [点我收藏+]
#!/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多进程脚本

原文:http://www.cnblogs.com/themost/p/7905475.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!