我的Linux服務器上有3個腳本,expA,expB和expC(Ubuntu 12.04 LTS)。 然後,我得到了32個輸入文件,命名爲nctu_0,nctu_1 ..... nctu_31。其中六個比他們大得多,所以我爲expA輸入3個輸入文件,3個輸入expB,另一個輸入expC。在後臺連續輸入文件的shell腳本
即 EXPA:運行nctu_6 nctu_13 nctu_17 ,EXPB:運行nctu_20 nctu_24 nctu_31 ,EXPC:運行中的其他文件
這裏是EXPB的原始腳本,並EXPA的劇本幾乎是一樣的EXPB
#!/bin/bash
PROGRAM=./Simulator
FILE_PART_PREFIX1=/home//data/pcap_partial/h1200/nctu_
RESULT_PREFIX1=/home/data/setup_exp/h1200
RECEIVER_SIZE=4096
SENDER_SIZE=4096
BETA=0.25
UPDATE=400
MARKER=20
part=20
if [ ${part} -eq 20 ];then
nohup ${PROGRAM} 1 ${FILE_PART_PREFIX1}${part}.pcap ${RECEIVER_SIZE} ${SENDER_SIZE} ${BETA} ${UPDATE} ${MARKER} ${MODE} >> ${RESULT_PREFIX1}/res_${part} 2>&1 &
fi
part=24
if [ ${part} -eq 24 ];then
nohup ${PROGRAM} 1 ${FILE_PART_PREFIX1}${part}.pcap ${RECEIVER_SIZE} ${SENDER_SIZE} ${BETA} ${UPDATE} ${MARKER} ${MODE} >> ${RESULT_PREFIX1}/res_${part} 2>&1 &
fi
part=31
if [ ${part} -eq 31 ];then
nohup ${PROGRAM} 1 ${FILE_PART_PREFIX1}${part}.pcap ${RECEIVER_SIZE} ${SENDER_SIZE} ${BETA} ${UPDATE} ${MARKER} ${MODE} >> ${RESULT_PREFIX1}/res_${part} 2>&1 &
fi
我想先運行nctu_20,然後運行nctu_24 nctu_24完成後。在nctu_24完成後最後運行nctu_31。
這裏是EXPC的原始腳本
#!/bin/bash
PROGRAM=./Simulator
FILE_PART_PREFIX1=/home/data/pcap_partial/h1200/nctu_
RESULT_PREFIX1=/home/data/setup_exp/h1200
RECEIVER_SIZE=4096
SENDER_SIZE=4096
BETA=0.25
UPDATE=400
MARKER=20
for ((part=0;part<32;part=part+1))
do
if [ ${part} -eq 6 ] || [ ${part} -eq 13 ] || [ ${part} -eq 17 ] || [ ${part} -eq 20 ] ||[ ${part} -eq 24 ] || [ ${part} -eq 31 ];then
continue
else
nohup ${PROGRAM} 1 ${FILE_PART_PREFIX1}${part}.pcap ${RECEIVER_SIZE} ${SENDER_SIZE} ${BETA} ${UPDATE} ${MARKER} ${MODE} >> ${RESULT_PREFIX1}/res_${part} 2>&1 &
fi
done
總之,我想在同一時間運行EXPA,EXPB EXPC和他們每個人發動模擬器程序,在一個連續的輸入文件的背景。有人能幫我嗎?