maybe more elegant

This commit is contained in:
CerberusV1
2024-10-16 16:42:43 +02:00
parent 6f5c254f4e
commit a7060598c3

View File

@@ -46,7 +46,7 @@ while true; do
# To check for sessions tmux ls and to reconnect to an existing one tmux a -t session_name # To check for sessions tmux ls and to reconnect to an existing one tmux a -t session_name
tmux new -d -s "${server_name}" "./start_server.sh" tmux new -d -s "${server_name}" "./start_server.sh"
# If EULA is not accepted, tells the user to accept the EULA before # If EULA is not accepted, tells the user to accept the EULA before
elif [[ ${condition} -eq 0 ]]; then elif [[ ${condition} -eq 0 ]]; then
echo "Before starting the server, please accept the EULA" echo "Before starting the server, please accept the EULA"
# An case that should only appear if more than just one EULA entry was made. # An case that should only appear if more than just one EULA entry was made.
# Either commented or not. This should be easily fixed by accepting the EULA again # Either commented or not. This should be easily fixed by accepting the EULA again
@@ -62,7 +62,7 @@ while true; do
echo "error - missing file "eula.txt"" echo "error - missing file "eula.txt""
fi fi
# If the user prompts n in the server start menu, he returns back to the main menu # If the user prompts n in the server start menu, he returns back to the main menu
elif [[ ${start_answer} == "n" ]]; then elif [[ ${start_answer} == "n" ]]; then
break break
# If the user prompts something else than y or n in the server start menu, he returns back to the main menu # If the user prompts something else than y or n in the server start menu, he returns back to the main menu
else else
@@ -103,7 +103,7 @@ while true; do
# If the user promts no, the EULA gets created/ overwritten and sets it to false. # If the user promts no, the EULA gets created/ overwritten and sets it to false.
# User also gets a reminder that he will not be able to start the server without accepting # User also gets a reminder that he will not be able to start the server without accepting
# to it # to it
elif [[ ${eula_answer} == "n" ]]; then elif [[ ${eula_answer} == "n" ]]; then
echo "# ${current_date}" > "${server}/eula.txt" echo "# ${current_date}" > "${server}/eula.txt"
echo "eula=false" >> "${server}/eula.txt" echo "eula=false" >> "${server}/eula.txt"
echo "Caution: You will not be able to start the serverwithout accepting to the EULA." echo "Caution: You will not be able to start the serverwithout accepting to the EULA."
@@ -114,55 +114,62 @@ while true; do
break break
;; ;;
"Set RAM") "Set RAM")
clear while true; do
echo " Allocate RAM " clear
echo "------------------------------------------------------------" echo " Allocate RAM "
presets=("1 GB" "2 GB" "4 GB" "8 GB" "16 GB" "Check") echo "------------------------------------------------------------"
select opt in "${presets[@]}"; do presets=("1 GB" "2 GB" "4 GB" "8 GB" "16 GB" "Check")
case $opt in select opt in "${presets[@]}"; do
"1 GB") case $opt in
echo "------------------------" "1 GB")
echo "Allocated 1GB of RAM" clear
echo "-Xms512M" > "${server}/user_jvm_args.txt" echo "------------------------"
echo "-Xmx1G" >> "${server}/user_jvm_args.txt" echo "Allocated 1GB of RAM"
;; echo "-Xms512M" > "${server}/user_jvm_args.txt"
"2 GB") echo "-Xmx1G" >> "${server}/user_jvm_args.txt"
echo "------------------------" ;;
echo "Allocated 2GB of RAM" "2 GB")
echo "-Xms1G" > "${server}/user_jvm_args.txt" clear
echo "-Xmx2G" >> "${server}/user_jvm_args.txt" echo "------------------------"
;; echo "Allocated 2GB of RAM"
"4 GB") echo "-Xms1G" > "${server}/user_jvm_args.txt"
echo "------------------------" echo "-Xmx2G" >> "${server}/user_jvm_args.txt"
echo "Allocated 4GB of RAM" ;;
echo "-Xms2G" > "${server}/user_jvm_args.txt" "4 GB")
echo "-Xmx4G" >> "${server}/user_jvm_args.txt" clear
;; echo "------------------------"
"8 GB") echo "Allocated 4GB of RAM"
echo "------------------------" echo "-Xms2G" > "${server}/user_jvm_args.txt"
echo "Allocated 8GB of RAM" echo "-Xmx4G" >> "${server}/user_jvm_args.txt"
echo "-Xms4G" > "${server}/user_jvm_args.txt" ;;
echo "-Xmx8G" >> "${server}/user_jvm_args.txt" "8 GB")
;; clear
"16 GB") echo "------------------------"
echo "------------------------" echo "Allocated 8GB of RAM"
echo "Allocated 16GB of RAM" echo "-Xms4G" > "${server}/user_jvm_args.txt"
echo "-Xms8G" > "${server}/user_jvm_args.txt" echo "-Xmx8G" >> "${server}/user_jvm_args.txt"
echo "-Xmx16G" >> "${server}/user_jvm_args.txt" ;;
;; "16 GB")
"Check") clear
echo "------------------------" echo "------------------------"
echo "User Args: " echo "Allocated 16GB of RAM"
echo " " echo "-Xms8G" > "${server}/user_jvm_args.txt"
cat "${server}/user_jvm_args.txt" echo "-Xmx16G" >> "${server}/user_jvm_args.txt"
echo " " ;;
break "Check")
;; echo "------------------------"
*) echo "User Args: "
echo "invalid input" echo " "
break cat "${server}/user_jvm_args.txt"
;; echo " "
esac break
;;
*)
echo "invalid input"
break
;;
esac
done
done done
read -p "Press Enter to return to main menu" read -p "Press Enter to return to main menu"
break break