File size: 1,043 Bytes
59961c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#/bin/bash

LISTS="937415_50525-sup.txt 937416_50298-sup.txt 937417_50216-sup.txt 937418_50869-sup.txt"
OFFER_NAME="HOM"
SEND_PER_BATCH=440
SLEEP_DEL_Q=50
SLEEP=50

for list in $LISTS; do
    cmp_id=`echo $list | cut -f 1 -d"_"`
    num_lines=`wc -l /home/pmta/list/${list} | cut -f 1 -d" "`
    n_iter=$(($num_lines/$SEND_PER_BATCH+1))
    cfg_file="/feeder/comcast/config_${OFFER_NAME}_${cmp_id}"

    cp /feeder/comcast/config $cfg_file

    sed -E -i 's/cmpid = "[^"]*"/cmpid = "'${cmp_id}'"/g' "$cfg_file"
    sed -E -i 's|(listfile = "/home/pmta/list/)[^"]+"|\1'${list}'"|g' "$cfg_file"

    cat <<- EOF >>commands_${OFFER_NAME}.txt

ext 'echo Pun config ${OFFER_NAME} ${cmp_id}'

ext 'cp /feeder/comcast/config_${OFFER_NAME}_${cmp_id} /feeder/comcast/config'

f

clspl

t

sleep 10

EOF

        for iter in $(seq ${n_iter}); do
                cat <<- EOF2 >>commands_${OFFER_NAME}.txt

send ${SEND_PER_BATCH},True

sleep ${SLEEP_DEL_Q}

ext 'pmta delete --queue=*/*'

sleep ${SLEEP}

EOF2
        done

done