-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathsetup_client.sh
More file actions
executable file
·53 lines (48 loc) · 1.07 KB
/
setup_client.sh
File metadata and controls
executable file
·53 lines (48 loc) · 1.07 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
squid_path="/etc/squid3/"
squid_cfg="./source/squid.conf"
echo "-> start building proxy service"
echo "-> update ubuntu, please wait for minutes ..."
apt-get update && apt-get upgrade -y 2>&1 > /dev/null
if [ $? -eq 0 ]
then
echo "-> install dependency packages, please wait for minutes ..."
apt-get install python-dev python-pip squid -y --force-yes 2>&1 > /dev/null
if [ $? -ne 0 ]
then
echo "!-> install failed"
exit 6
fi
else
echo "!-> update failed"
exit 6
fi
echo "-> install python requests ..."
pip install requests 2>&1 > /dev/null
if [ $? -ne 0 ]
then
exit 6
fi
if [ -e $squid_cfg ]
then
echo "-> copy squid config to /etc path"
cp $squid_cfg $squid_path
else
echo "squid config not found in source/"
exit 66
fi
echo "reconfigure squid ..."
squid3 -k reconfigure 2>&1 > /dev/null
if [ $? -eq 0 ]
then
cd client/
nohup python run.py &
if [ $? -ne 0 ]
then
echo "start proxy client task failed"
exit 66
fi
else
echo "reconfigure squid3 failed"
exit 66
fi