Update install_quilibrium_service.sh

added
check if ceremonyclient folder exists and remove it
check if service file exists before trying to remove it
This commit is contained in:
LaMat 2024-05-25 18:26:18 +02:00 committed by GitHub
parent c3fa3fa581
commit d6697b952e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,8 +31,30 @@ else
fi
sudo sysctl -p
# Step 3: Check if directory ~/ceremonyclient exists and remove it
if [ -d ~/ceremonyclient ]; then
# Check if backup directory ~/backup/qnode_keys exists, if not create it
if [ ! -d ~/backup/qnode_keys ]; then
mkdir -p ~/backup/qnode_keys
fi
# Check if files exist, then backup
if [ -f ~/ceremonyclient/node/.config/keys.yml ]; then
cp ~/ceremonyclient/node/.config/keys.yml ~/backup/qnode_keys/
echo "✅ Backup of keys.yml created in ~/backup/qnode_keys folder"
fi
if [ -f ~/ceremonyclient/node/.config/config.yml ]; then
cp ~/ceremonyclient/node/.config/config.yml ~/backup/qnode_keys/
echo "✅ Backup of config.yml created in ~/backup/qnode_keys folder"
fi
# Remove existing directory ~/ceremonyclient
echo "🗑️ Removing existing directory ~/ceremonyclient..."
rm -rf ~/ceremonyclient
fi
# Step 8:Download Ceremonyclient
# Step 4:Download Ceremonyclient
echo "⏳Downloading Ceremonyclient"
sleep 1 # Add a 1-second delay
cd ~
@ -43,7 +65,7 @@ git checkout release
# Get the system architecture
ARCH=$(uname -m)
# Step10.1:Determine the ExecStart line based on the architecture
# Step 5:Determine the ExecStart line based on the architecture
if [ "$ARCH" = "x86_64" ]; then
EXEC_START="/root/ceremonyclient/node/node-1.4.18-linux-amd64"
elif [ "$ARCH" = "aarch64" ]; then
@ -55,10 +77,20 @@ else
exit 1
fi
# Step10.2:Create Ceremonyclient Service
# Step 6:Create Ceremonyclient Service
echo "⏳ Re-Creating Ceremonyclient Service"
sleep 2 # Add a 2-second delay
rm /lib/systemd/system/ceremonyclient.service
# 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
sudo tee /lib/systemd/system/ceremonyclient.service > /dev/null <<EOF
[Unit]
Description=Ceremony Client Go App Service
@ -75,13 +107,13 @@ WantedBy=multi-user.target
EOF
systemctl enable ceremonyclient
# Start the ceremonyclient service
# Step 7: Start the ceremonyclient service
echo "✅Starting Ceremonyclient Service"
sleep 1 # Add a 1-second delay
service ceremonyclient start
# See the logs of the ceremonyclient service
# Step 8: See the logs of the ceremonyclient service
echo "🎉Welcome to Quilibrium Ceremonyclient"
echo "⏳Please let it flow node logs at least 5 minutes then you can press CTRL + C to exit the logs."
sleep 5 # Add a 5-second delay
sudo journalctl -u ceremonyclient.service -f --no-hostname -o cat
sudo journalctl -u ceremonyclient.service -f --no-hostname -o cat