2013-07-01 2 views
0

마스터 서버가 4 개의 슬레이브 (1 개의 슬레이브 = 마스터)에서 스크립트를 실행하는 프로젝트가 있습니다.SSH 세션 중단

모든 4 노예가 평행이 같은 & 문을 사용하여 부름 :

sh /data/lpc/scripts/Remote_Execution/Python0/scrap_data_param.sh Python0 $Python0_ip & 
    sh /data/lpc/scripts/Remote_Execution/Python1/scrap_data_param.sh Python1 $Python1_ip & 
    sh /data/lpc/scripts/Remote_Execution/Python2/scrap_data_param.sh Python2 $Python2_ip & 
    sh /data/lpc/scripts/Remote_Execution/Python3/scrap_data_param.sh Python3 $Python3_ip 

스크립트 * scrap_data_param * 원격 IP와 ssh를 연결하고 루프에서 다양한 명령을 실행합니다.

SSH 세션이 완료되고 다음 루프 문을 반복 심지어 특정 SSH 세션의 완료 전에이다 내가 직면하고 문제 :

while read line 
do 
c="n" 
for word in $line 
do 
if [ "$c" = "n" ]; then 
ssh $python_server_ip -n -p 1754 sh /data/lpc/scripts/remote_scraping.sh $word_match $word 
done 
ssh $python_server_ip -n -p 1754 sh /data/lpc/scripts/remote_matching.sh $word_match 

done <'ssss.txt' 
:

내가 참조를 위해 scrap_data_param.sh를 첨부

SO 루프는 하나의 명령문이 완료되기 전에 다음 ssh $python_server_ip -n -p 1754 sh /data/lpc/scripts/remote_matching.sh $word_match 문을 반복합니다.

답변

0

하나의 오래된 학교 책 속임수는 충분한 시간 동안 연속 명령 사이에 sleep 문을 넣는 것일 수 있습니다.

같은 말 ..

while read line 
do 
c="n" 
for word in $line 
do 
if [ "$c" = "n" ]; then 
ssh $python_server_ip -n -p 1754 sh /data/lpc/scripts/remote_scraping.sh $word_match $word 
sleep 10; 
done 
ssh $python_server_ip -n -p 1754 sh /data/lpc/scripts/remote_matching.sh $word_match 
done <'ssss.txt' 
관련 문제