<commit_before>#!/bin/bash
# this script uses lxc to run multiple instances of SocialVPN
# this script is designed for Ubuntu 12.04 (64-bit)

USERNAME=$1
PASSWORD=$2
XMPP_HOST=$3
NO_CONTAINERS=$4
HOST=$(hostname)
IP_PREFIX="172.16.5"
START_PATH=container/rootfs/home/ubuntu/start.sh

sudo apt-get update
sudo apt-get install -y lxc tcpdump

wget -O ubuntu.tgz http://goo.gl/Ze7hYz
wget -O container.tgz http://goo.gl/XJgdtf
wget -O svpn.tgz http://goo.gl/R8sfm6

sudo tar xzf ubuntu.tgz; tar xzf container.tgz; tar xzf svpn.tgz
sudo cp -a ubuntu/* container/rootfs/
sudo mv container/home/ubuntu container/rootfs/home/ubuntu/
mv svpn container/rootfs/home/ubuntu/svpn/

sudo tcpdump -i eth0 -w svpn_$HOST.cap &> /dev/null &

cat > $START_PATH << EOF
#!/bin/bash
SVPN_HOME=/home/ubuntu/svpn
CONFIG=\`cat \$SVPN_HOME/config\`
\$SVPN_HOME/svpn-jingle &> \$SVPN_HOME/svpn_log.txt &
python \$SVPN_HOME/vpn_controller.py \$CONFIG &> \$SVPN_HOME/controller_log.txt &
EOF

chmod 755 $START_PATH

for i in $(seq 1 $NO_CONTAINERS)
do
    container_name=container$i
    lxc_path=/var/lib/lxc
    container_path=$lxc_path/$container_name

    sudo cp -a container $container_name
    echo -n "$USERNAME $PASSWORD $XMPP_HOST" > \
             $container_name/rootfs/home/ubuntu/svpn/config

    #echo -n "$USERNAME $PASSWORD $XMPP_HOST $IP_PREFIX.$i" > \
    #         $container_name/rootfs/home/ubuntu/svpn/config

    sudo mv $container_name $lxc_path
    sudo echo "lxc.rootfs = $container_path/rootfs" >> $container_path/config
    sudo echo "lxc.mount = $container_path/fstab" >> $container_path/config
    sudo lxc-start -n $container_name -d
    sleep 15
done

<commit_msg>Now added wait interval as a parameter<commit_after>#!/bin/bash
# this script uses lxc to run multiple instances of SocialVPN
# this script is designed for Ubuntu 12.04 (64-bit)

USERNAME=$1
PASSWORD=$2
XMPP_HOST=$3
NO_CONTAINERS=$4
WAIT_INTERVAL=$5
HOST=$(hostname)
IP_PREFIX="172.16.5"
START_PATH=container/rootfs/home/ubuntu/start.sh

sudo apt-get update
sudo apt-get install -y lxc tcpdump

wget -O ubuntu.tgz http://goo.gl/Ze7hYz
wget -O container.tgz http://goo.gl/XJgdtf
wget -O svpn.tgz http://goo.gl/1nmORG

sudo tar xzf ubuntu.tgz; tar xzf container.tgz; tar xzf svpn.tgz
sudo cp -a ubuntu/* container/rootfs/
sudo mv container/home/ubuntu container/rootfs/home/ubuntu/
mv svpn container/rootfs/home/ubuntu/svpn/

sudo tcpdump -i eth0 -w svpn_$HOST.cap &> /dev/null &

cat > $START_PATH << EOF
#!/bin/bash
SVPN_HOME=/home/ubuntu/svpn
CONFIG=\`cat \$SVPN_HOME/config\`
\$SVPN_HOME/svpn-jingle &> \$SVPN_HOME/svpn_log.txt &
python \$SVPN_HOME/vpn_controller.py \$CONFIG &> \$SVPN_HOME/controller_log.txt &
EOF

chmod 755 $START_PATH

for i in $(seq 1 $NO_CONTAINERS)
do
    container_name=container$i
    lxc_path=/var/lib/lxc
    container_path=$lxc_path/$container_name

    sudo cp -a container $container_name
    echo -n "$USERNAME $PASSWORD $XMPP_HOST" > \
             $container_name/rootfs/home/ubuntu/svpn/config

    #echo -n "$USERNAME $PASSWORD $XMPP_HOST $IP_PREFIX.$i" > \
    #         $container_name/rootfs/home/ubuntu/svpn/config

    sudo mv $container_name $lxc_path
    sudo echo "lxc.rootfs = $container_path/rootfs" >> $container_path/config
    sudo echo "lxc.mount = $container_path/fstab" >> $container_path/config
    sudo lxc-start -n $container_name -d
    sleep $WAIT_INTERVAL
done


{'fraction_non_alphanumeric': 0.12477876106194691, 'fraction_numerical': 0.014749262536873156, 'mean_word_length': 3.803116147308782, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1027503', 'n_tokens_mistral': 1421, 'n_tokens_neox': 1281, 'n_words': 293}