forked from engageub/InternetIncome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
restart.sh
111 lines (102 loc) · 3.46 KB
/
restart.sh
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
if [[ "$1" == "--restartAdnade" ]]; then
firefox_profile_data="firefoxprofiledata"
i=0
for container in `cat adnadecontainers.txt`
do
i=`expr $i + 1`
# Check if container exists
docker update --restart=no $container
docker stop $container
# Firefox with direct connection
if [ -d "/firefox/adnadedata/data" ];then
chmod -R 777 /firefox/adnadedata/data
rm -rf /firefox/adnadedata/data/*
cp -r /firefox/$firefox_profile_data/* adnadedata/data/
chmod -R 777 /firefox/adnadedata/data
docker update --restart=always $container
sleep 300
docker start $container
exit 1
fi
if [ ! -d "/firefox/adnadedata/data$i" ];then
echo "Folder data$i does not exist. Exiting.."
exit 1
fi
# Deleting data and starting containers
chmod -R 777 /firefox/adnadedata/data$i
rm -rf /firefox/adnadedata/data$i/*
cp -r /firefox/$firefox_profile_data/* adnadedata/data$i/
chmod -R 777 /firefox/adnadedata/data$i
docker update --restart=always $container
if [ $i == 1 ];then
sleep 300
fi
docker start $container
done
elif [[ "$1" == "--restartChrome" ]]; then
chrome_profile_data="chromeprofiledata"
chrome_data_folder="chromedata"
i=0
for container in `cat chromecontainers.txt`
do
i=`expr $i + 1`
# Check if container exists
docker update --restart=no $container
docker stop $container
# Chrome with direct connection
if [ -d "/chrome/$chrome_data_folder/data" ];then
chmod -R 777 /chrome/$chrome_data_folder/data
rm -rf /chrome/$chrome_data_folder/data/*
chown -R 911:911 /chrome/$chrome_profile_data
cp -r /chrome/$chrome_profile_data /chrome/$chrome_data_folder/data
chown -R 911:911 /chrome/$chrome_data_folder/data
docker update --restart=always $container
docker start $container
exit 1
fi
if [ ! -d "/chrome/$chrome_data_folder/data$i" ];then
echo "Folder data$i does not exist. Exiting.."
exit 1
fi
# Deleting data and starting containers
chmod -R 777 /chrome/$chrome_data_folder/data$i
rm -rf /chrome/$chrome_data_folder/data$i/*
chown -R 911:911 /chrome/$chrome_profile_data
cp -r /chrome/$chrome_profile_data /chrome/$chrome_data_folder/data$i
chown -R 911:911 /chrome/$chrome_data_folder/data$i
docker update --restart=always $container
docker start $container
done
elif [[ "$1" == "--restartFirefox" ]]; then
firefox_profile_data="firefoxprofiledata"
i=0
for container in `cat firefoxcontainers.txt`
do
i=`expr $i + 1`
# Check if container exists
docker update --restart=no $container
docker stop $container
# Firefox with direct connection
if [ -d "/firefox/firefoxdata/data" ];then
chmod -R 777 /firefox/firefoxdata/data
rm -rf /firefox/firefoxdata/data/*
cp -r /firefox/$firefox_profile_data/* firefoxdata/data/
chmod -R 777 /firefox/firefoxdata/data
docker update --restart=always $container
docker start $container
exit 1
fi
if [ ! -d "/firefox/firefoxdata/data$i" ];then
echo "Folder data$i does not exist. Exiting.."
exit 1
fi
# Deleting data and starting containers
chmod -R 777 /firefox/firefoxdata/data$i
rm -rf /firefox/firefoxdata/data$i/*
cp -r /firefox/$firefox_profile_data/* firefoxdata/data$i/
chmod -R 777 /firefox/firefoxdata/data$i
docker update --restart=always $container
docker start $container
done
fi