-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate.sh
37 lines (28 loc) · 1.02 KB
/
update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# login to the vps without password prompt
sudo -n true
if [ $? -ne 0 ]; then
echo "Passwordless sudo is not configured. Please configure passwordless sudo for the current user."
exit 1
fi
# Display status message
echo "Updating and building..."
# Stash any changes
git stash &>/dev/null
echo "Stashing changes..."
# Pull the latest changes from the remote repository
git pull &>/dev/null
echo "Pulling latest changes..."
# Install npm update
npm install --force &>/dev/null
echo "Installing npm packages..."
# Remove the 'dist' directory if it exists
rm -rf dist &>/dev/null
echo "Removing 'dist' directory..."
# Build the project and start
echo "Building project... and starting server..."
npm run preview
# Display a message indicating the update and build process is complete
echo "Update and build process complete."
# PM2 Command --> pm2 start "cd /home/vps3/MRCM-Sport-Meet-Frontend && ./update.sh" --name "MRCM-SPORT-MEET-FRONTEND"
# pm2 start "./update.sh" --name "MRCM-SPORT-MEET-FRONTEND" --user vps3