From 6254d4742667d37f5725e81770fd521dd5ebcc07 Mon Sep 17 00:00:00 2001 From: Sefinek Date: Sat, 18 Jan 2025 03:36:15 +0100 Subject: [PATCH] Fixes --- install.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index c8b6852..9d0725d 100644 --- a/install.sh +++ b/install.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +USER=${SUDO_USER:-$(whoami)} + # Function to prompt for a Yes/no answer yes_no_prompt() { local prompt="$1" @@ -179,19 +181,19 @@ chown "$USER":"$USER" /var/log/ufw-abuseipdb -R # Configure pm2 echo "āš™ļø Configuring PM2..." -pm2 start -pm2 startup +sudo -u "$USER" pm2 start +sudo -u "$USER" pm2 startup # Execute the command generated by pm2 startup -echo "šŸ”§ Complete pm2 startup configuration:" +echo "šŸ”§ Complete pm2 startup configuration (for $USER):" sudo env PATH="$PATH":/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u "$USER" --hp /opt/"$USER" -pm2 save +sudo -u "$USER" pm2 save # Final echo -e "\n\n🌌 Checking PM2 status..." -pm2 status +sudo -u "$USER" pm2 status echo -e "\nšŸŽ‰ Installation and configuration completed! Use the 'pm2 logs' command to monitor logs in real time."