Fixes
This commit is contained in:
1 parent
6378657cab
commit
701e46285d
1 file changed
+12
-4
+12
-4
@@ -170,11 +170,16 @@ git pull || { echo "❌ Failed to pull the latest changes. Exiting..."; exit 1;
|
|||||||
|
|
||||||
# Install npm dependencies
|
# Install npm dependencies
|
||||||
echo "📦 Installing npm dependencies..."
|
echo "📦 Installing npm dependencies..."
|
||||||
npm install
|
npm install -silent
|
||||||
|
|
||||||
# Copy configuration file
|
# Copy configuration file
|
||||||
|
echo "📑 Checking if config.js exists..."
|
||||||
|
if [ -e config.js ]; then
|
||||||
|
echo "⚠️ config.js already exists. Skipping copy..."
|
||||||
|
else
|
||||||
echo "📑 Copying default.config.js to config.js..."
|
echo "📑 Copying default.config.js to config.js..."
|
||||||
cp default.config.js config.js
|
cp default.config.js config.js
|
||||||
|
fi
|
||||||
|
|
||||||
# Update config.js with API token, Server ID, and UFW log path
|
# Update config.js with API token, Server ID, and UFW log path
|
||||||
config_file="config.js"
|
config_file="config.js"
|
||||||
@@ -205,15 +210,18 @@ sudo npm uninstall corepack -g -silent
|
|||||||
echo "📦 Installing PM2..."
|
echo "📦 Installing PM2..."
|
||||||
sudo npm install pm2 -g -silent
|
sudo npm install pm2 -g -silent
|
||||||
|
|
||||||
|
|
||||||
# Configure PM2
|
# Configure PM2
|
||||||
echo "⚙️ Adding PM2 to autostart..."
|
echo "⚙️ Adding PM2 to autostart..."
|
||||||
startup_command=$(pm2 startup | grep "sudo env PATH" | sed 's/^[^s]*sudo/sudo/')
|
startup_command=$(pm2 startup | grep "sudo env PATH" | sed 's/^[^s]*sudo/sudo/')
|
||||||
|
|
||||||
if [ -n "$startup_command" ]; then
|
if [ -n "$startup_command" ]; then
|
||||||
echo "⚙️ $startup_command..."
|
echo "⚙️ Executing: $startup_command"
|
||||||
eval "$startup_command"
|
eval "$startup_command" &>/dev/null || {
|
||||||
|
echo "❌ Failed to execute the startup command!"
|
||||||
|
}
|
||||||
else
|
else
|
||||||
echo "❌ Failed to find the command generated by 'pm2 startup'! PM2 was not added to autostart."
|
echo "❌ Failed to find the command generated by pm2 startup! PM2 was not added to autostart."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "⚙️ Running PM2 save..."
|
echo "⚙️ Running PM2 save..."
|
||||||
|
|||||||
Reference in new issue
Block a user