summaryrefslogtreecommitdiff
path: root/start.sh
blob: 1ebbae45c90ae584093aa6981f7e0f7eede396a8 (plain)
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
#!/bin/sh
# Copy the traffic_replay folder to the virtual machine used to send packets,the paht is /opt.
# Run the command at /opt/traffic_replay: ./start.sh

if [[ "$(command -v python3)" == "" ]]; then
    echo "No python3, start to installing."
    yum -y update
    yum install -y net-tools wget python3-devel python3 python3-pip pciutils
    pip3 install --no-cache-dir scapy
    pip3 install --no-cache-dir PyYAML
    pip3 install --no-cache-dir requests
    pip3 install --no-cache-dir Flask
    pip3 install --no-cache-dir gunicorn
    echo "Python3 and related packages have been created."
else
    echo "Exist python3 and related packages."
fi

systemctl disable firewalld.service

chmod 777 /opt/traffic_replay/*.py

python3 /opt/traffic_replay/install_trex.py
# python3 /opt/traffic_replay/app.py
gunicorn -c gunicorn.conf.py app:app &