From 1060a4ee986a59dc21f187dbf6d56cad50ecc759 Mon Sep 17 00:00:00 2001 From: Clarence Dan <48417261+ClarenceDan@users.noreply.github.com> Date: Sat, 1 Jun 2024 10:53:08 +0800 Subject: [PATCH] Update install.sh stop service if ceremoyclient service exist to avoid threads conflict add swapfile to avoid memory issue remove the exist service to rebuild service add cpulimit for each worker to 95% --- install/install.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/install/install.sh b/install/install.sh index 237f159..a137db4 100644 --- a/install/install.sh +++ b/install/install.sh @@ -10,6 +10,25 @@ echo "⏳Enjoy and sit back while you are building your Quilibrium Node!" echo "⏳Processing..." sleep 10 # Add a 10-second delay +# Check if ceremonyclient service exists and stop it if it does +if sudo systemctl status ceremonyclient &> /dev/null; then + echo "Ceremonyclient service found. Stopping..." + sudo service ceremonyclient stop + sleep 2 # Add a 2-second delay +fi + +# Step 0: Increase Swap Space +if [ ! -d /swap ]; then + echo "Increasing swap space..." + sudo mkdir /swap + sudo fallocate -l 16G /swap/swapfile + sudo chmod 600 /swap/swapfile + sudo mkswap /swap/swapfile + sudo swapon /swap/swapfile + echo '/swap/swapfile swap swap defaults 0 0' | sudo tee -a /etc/fstab +else + echo "Swap space already exists, skipping swap increase..." +fi # Step 1: Update and Upgrade the Machine echo "Updating the machine" @@ -115,6 +134,20 @@ EXEC_START="$NODE_PATH/release_autorun.sh" # Create Ceremonyclient Service echo "⏳Creating Ceremonyclient Service" sleep 1 # Add a 1-second delay + +# Check if the file exists before attempting to remove it +if [ -f "/lib/systemd/system/ceremonyclient.service" ]; then + # If the file exists, remove it + rm /lib/systemd/system/ceremonyclient.service + echo "ceremonyclient.service file removed." +else + # If the file does not exist, inform the user + echo "ceremonyclient.service file does not exist. No action taken." +fi + +CPU_THREADS=$(nproc) +CPU_QUOTA=$(( CPU_THREADS * 90 )) + sudo tee /lib/systemd/system/ceremonyclient.service > /dev/null <