-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstartServer.sh
58 lines (38 loc) · 2.32 KB
/
startServer.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
#! /bin/bash
# Bash script to start server.
# Spigot Logs
mkdir -p logs
my_ip=$(ifconfig eno1 | grep 'inet '| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $2}' | tr '.' '_')
current_time="${my_ip}_$(date "+%Y%m%d_%H%M%S")"
mkdir -p "logs/${current_time}"
echo $current_time > log_dest.tmp
tmp=$(cat log_dest.tmp)
echo "${tmp}.log"
log_file="logs/${current_time}/mcc_${current_time}.log"
plan_file="logs/${current_time}/plan_${current_time}.json"
touch $log_file
printf "\nLog file created ${log_file}" | tee -a $log_file
# printf "\n"
# exit 1
# Generate Plan
printf "\nGenerating plan..."
# python3 plan_generator/plan_generator.py --num_final_mat=1 --output_path=spigot/plan.json --upper_complex_lim=2 --lower_complex_lim=2 --num_tools=2 --disparate_knowledge # DK-DS
# python3 plan_generator/plan_generator.py --num_final_mat=1 --output_path=spigot/plan.json --upper_complex_lim=3 --lower_complex_lim=3 --num_tools=3 --disparate_knowledge # DK-DS
python3 plan_generator/plan_generator.py --num_final_mat=1 --output_path=spigot/plan.json --upper_complex_lim=4 --lower_complex_lim=4 --num_tools=3 --disparate_knowledge # DK-DS
# python3 plan_generator/plan_generator.py --num_final_mat=1 --output_path=spigot/plan.json --upper_complex_lim=2 --lower_complex_lim=2 --num_tools=1 # SK-SS
# python3 plan_generator/plan_generator.py --num_final_mat=1 --output_path=spigot/plan.json --upper_complex_lim=2 --lower_complex_lim=2 --num_tools=2 --disparate_knowledge # DK-DS
# python3 plan_generator/plan_generator.py --num_final_mat=1 --output_path=spigot/plan.json --upper_complex_lim=2 --lower_complex_lim=2 --num_tools=1 --disparate_knowledge # DK-SS
# python3 plan_generator/plan_generator.py --num_final_mat=1 --output_path=spigot/plan.json --upper_complex_lim=2 --lower_complex_lim=2 --num_tools=2 # SK-DS
cp spigot/plan.json $plan_file
cp spigot/plan.json mean/plan.json
printf "Done!\n"
# Start Server
printf "\nStarting Server...\n\n" | tee -a $log_file
bash spigot/start.command 2>&1 | tee -a $log_file
echo "Minecraft server stopped!"
# asks for password
mysqldump --add-drop-table -u root --password minecraft > "logs/${current_time}/mcc_${current_time}.sql"
echo "Dataset Dumped!"
# asks for password
echo "DROP DATABASE minecraft; CREATE DATABASE minecraft;" | mysql -u root -p
echo "Dataset reset!"