-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_all_crawlers_once.sh
executable file
·53 lines (41 loc) · 1.69 KB
/
run_all_crawlers_once.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
#!/bin/bash
profile_1="/home/ec2-user/.config/google-chrome/thirdPartyCookiesDisabled/safariProfile1"
profile_1_copy="/home/ec2-user/.config/google-chrome/thirdPartyCookiesDisabled/safariProfile1copy"
profile_2="/home/ec2-user/.config/google-chrome/thirdPartyCookiesDisabled/safariProfile2"
chrome_profile="/home/ec2-user/.config/google-chrome/thirdPartyCookiesDisabled/chromeProfile"
# Delete the old profiles
rm -r $profile_1
rm -r $profile_2
rm -r $chrome_profile
# Create the new profiles
cd /
cp -r "/home/ec2-user/.config/google-chrome/thirdPartyCookiesDisabled/Default" $profile_1
cp -r "/home/ec2-user/.config/google-chrome/thirdPartyCookiesDisabled/Default" $profile_2
cp -r "/home/ec2-user/.config/google-chrome/thirdPartyCookiesDisabled/Default" $chrome_profile
# Run all of the crawlers
ds=`date '+%Y-%m-%d_%H-%M-%S'`
cd "/home/ec2-user/brave-redirection-recorder"
# Start the controller
node lib/controller &
controller_pid=$!
# node test.js "https://$1" $profile_1 > /data/crawlerOutput/safariProfile1/$1_$ds.txt &
# node test.js "https://$1" $profile_2 > /data/crawlerOutput/safariProfile2/$1_$ds.txt &
# node test.js "https://$1" $chrome_profile > /data/crawlerOutput/chromeProfile/$1_$ds.txt &
node test.js "https://$1" $profile_1 > tmp1.txt &
pid_1=$!
node test.js "https://$1" $profile_2 > tmp2.txt &
pid_2=$!
node test.js "https://$1" $chrome_profile > tmp3.txt &
pid_3=$!
# Wait for them to finish
wait $pid_1
wait $pid_2
wait $pid_3
# Now run the fourth crawler, that uses a copy of safariProfile1
# Copy safariProfile1
cp -r $profile_1 $profile_1_copy
node rerun_crawler.js $line $profile_1_copy > tmp4.txt
# Clear profile_1_copy
rm -r $profile_1_copy
# Stop the controller
kill $controller_pid