-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·41 lines (32 loc) · 794 Bytes
/
start.sh
File metadata and controls
executable file
·41 lines (32 loc) · 794 Bytes
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
40
41
#!/bin/bash
# Check if running as root
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit 1
fi
# accept forwarding packets
iptables -P FORWARD ACCEPT
if ! grep "^net.ipv4.ip_forward=1$" /etc/sysctl.conf > /dev/null
then
echo net.ipv4.ip_forward=1 >> /etc/sysctl.conf
sysctl -p
fi
# masq outbound interface
dev=$(ip route get 10.0.0.0 | grep -Po "(?<=(dev ))(\S+)")
if ! iptables -S -t nat | grep "\-o $dev \-j MASQUERADE" > /dev/null
then
iptables -t nat -A POSTROUTING -o $dev -j MASQUERADE
fi
cd /opt/ordig
docker-compose up -d
cd server
server="$(grep api_url config.json | awk -F \" '{print $4}')"
while [ "$(curl -s -o /dev/null -w "%{http_code}" $server/public/works)" != 200 ]
do
echo "Waiting for API..."
sleep 5
done
while true
do
python3 daemon.py
done