-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcurl_setup.sh
executable file
·85 lines (67 loc) · 3.26 KB
/
curl_setup.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
#!/bin/bash
#Script to set up the CRC Queue heat-map. Thats what it's called I guess.
#8/3/16
#Requires sudo permission. This script assumes you have apache2 running and
#php7.0(or something compatible). Default path is listed below.
#This needs to be an absolute path
desired_path="/var/www/html" #you can change this if need be
#CRC info to gather files
webpage_url="CURL URL HERE !!!!!!!!!!!!!"
#Local info to mv files to protected areas
psword="LOCAL PASSWORD OR CHANGE SUDOERS FILE!!!!!!!!!!!"
long_file="long_nodes.txt" #These can stay this way
debug_file="debug_nodes.txt" # "
#Creating dirs moving files to proper locations
echo "Creating Debug, Long, and Pending directories in $desired_path . . ."
echo $psword | sudo -S mkdir $desired_path/Debug
echo $psword | sudo -S mkdir $desired_path/Long
echo $psword | sudo -S mkdir $desired_path/Pending
#Creating Memory-Dir's
echo $psword | sudo -S mkdir $desired_path/Debug-memory
echo $psword | sudo -S mkdir $desired_path/Long-memory
echo "Moving index's to their rightful places . . ."
echo $psword | sudo -S cp index-long.php $desired_path/Long/index.php
echo $psword | sudo -S cp index-long.php $desired_path/Long-memory/index.php
echo $psword | sudo -S cp index-debug.php $desired_path/Debug/index.php
echo $psword | sudo -S cp index-debug.php $desired_path/Debug-memory/index.php
echo $psword | sudo -S cp index-pending.php $desired_path/Pending/index.php
echo "Transferring templates to $desired_path . . ."
echo $psword | sudo -S cp -r templates $desired_path/templates
echo "Transferring styles.css to $desired_path . . ."
echo $psword | sudo -S cp styles.css $desired_path/
echo "Gathering node-list files from $webpage_url . . ."
curl -o debug_nodes.txt $webpage_url/debug_node_list.html
curl -o long_nodes.txt $webpage_url/long_node_list.html
# Creating and initialiizing each node's dir etc
#Long-queue nodes
echo "Creating each node's dir at $desired_path/Long . . ."
while IFS= read -r line
do
echo $psword | sudo -S mkdir $desired_path/Long/$line
echo $psword | sudo -S cp sub-index.php $desired_path/Long/$line/index.php
done < "$long_file"
echo "Creating each node's dir at $desired_path/Debug . . ."
#Debug-queue nodes
while IFS= read -r line
do
echo $psword | sudo -S mkdir $desired_path/Debug/$line
echo $psword | sudo -S cp sub-index.php $desired_path/Debug/$line/index.php
done < "$debug_file"
echo "-----------------------COMPLETE-----------------------"
echo ""
echo "Setup complete. Please quickly verify everything was made correctly."
echo "You can do this by opening a browser and going to localhost and navigating"
echo "to your Long or Debug directories."
echo ""
echo "Please be sure that the python script is running on a front end, and that"
echo "all scripts are configured to the location the script is going to be spitting"
echo "out at."
echo ""
echo "Once you know things are where they should be, make sure you configured the"
echo "grab_queue_files.sh script for your info to grab the files."
echo "If it is configured already, either of the two lines to crontab -e:"
echo "If you chose method(1) as described in README, add this to cron:"
echo "*/2 * * * * $(pwd)/grab_queue_files.sh"
echo ""
echo "If you chose method(2), add this to cron:"
echo "*/2 * * * * $(pwd)/curl_queue_files.sh"