mirror of
https://github.com/tl-open-source/tl-rtc-file.git
synced 2025-10-05 23:46:49 +08:00
feat: auto check install shell/bat
This commit is contained in:
@@ -1,46 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Step 1: Check if Node.js is installed and install Node.js 18 if not
|
|
||||||
if ! command -v node &> /dev/null; then
|
|
||||||
echo "Node.js is not installed. Installing Node.js 18..."
|
|
||||||
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
|
|
||||||
sudo apt-get install -y nodejs
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 2: Output Node.js and npm versions
|
|
||||||
node_version=$(node -v)
|
|
||||||
npm_version=$(npm -v)
|
|
||||||
echo "Node.js version: $node_version"
|
|
||||||
echo "npm version: $npm_version"
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
# Step 3: Check if pm2 is installed and install it globally if not
|
|
||||||
if ! command -v pm2 &> /dev/null; then
|
|
||||||
echo "pm2 is not installed. Installing pm2 globally..."
|
|
||||||
sudo npm install -g pm2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 4: Output pm2 version
|
|
||||||
pm2_version=$(pm2 -v)
|
|
||||||
echo "pm2 version: $pm2_version"
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
# Step 5: Check if ports 9092 and 8444 are occupied
|
|
||||||
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
|
|
||||||
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
|
|
||||||
|
|
||||||
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
|
|
||||||
echo "Port 9092 or 8444 is already in use."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 6: install npm packages
|
|
||||||
echo "ready to install npm packages"
|
|
||||||
cd ../../svr/
|
|
||||||
npm install --registry=https://registry.npmmirror.com
|
|
||||||
cd ../bin/linux/
|
|
||||||
|
|
||||||
# Step 7: Run start-https.sh script to start the service
|
|
||||||
echo "ready to run auto-start-https.sh"
|
|
||||||
sleep 1
|
|
||||||
./auto-start-https.sh
|
|
@@ -1,46 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Step 1: Check if Node.js is installed and install Node.js 18 if not
|
|
||||||
if ! command -v node &> /dev/null; then
|
|
||||||
echo "Node.js is not installed. Installing Node.js 18..."
|
|
||||||
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
|
|
||||||
sudo apt-get install -y nodejs
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 2: Output Node.js and npm versions
|
|
||||||
node_version=$(node -v)
|
|
||||||
npm_version=$(npm -v)
|
|
||||||
echo "Node.js version: $node_version"
|
|
||||||
echo "npm version: $npm_version"
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
# Step 3: Check if pm2 is installed and install it globally if not
|
|
||||||
if ! command -v pm2 &> /dev/null; then
|
|
||||||
echo "pm2 is not installed. Installing pm2 globally..."
|
|
||||||
sudo npm install -g pm2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 4: Output pm2 version
|
|
||||||
pm2_version=$(pm2 -v)
|
|
||||||
echo "pm2 version: $pm2_version"
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
# Step 5: Check if ports 9092 and 8444 are occupied
|
|
||||||
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
|
|
||||||
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
|
|
||||||
|
|
||||||
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
|
|
||||||
echo "Port 9092 or 8444 is already in use."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 6: install npm packages
|
|
||||||
echo "ready to install npm packages"
|
|
||||||
cd ../../svr/
|
|
||||||
npm install --registry=https://registry.npmmirror.com
|
|
||||||
cd ../bin/linux/
|
|
||||||
|
|
||||||
# Step 7: Run start-https.sh script to start the service
|
|
||||||
echo "ready to run auto-start-https.sh"
|
|
||||||
sleep 1
|
|
||||||
./auto-start-https.sh
|
|
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
pm2 stop all
|
|
||||||
|
|
||||||
echo "stop all pm2 processes ok"
|
|
101
bin/ubuntu16/auto-check-install-http.sh
Executable file
101
bin/ubuntu16/auto-check-install-http.sh
Executable file
@@ -0,0 +1,101 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Function to install Node.js 16
|
||||||
|
install_node() {
|
||||||
|
echo "======>Node.js is not installed. Installing Node.js 16..."
|
||||||
|
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
|
||||||
|
sudo apt-get install -y nodejs
|
||||||
|
echo "======>Node.js 16 installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install pm2 globally
|
||||||
|
install_pm2() {
|
||||||
|
echo "======>pm2 is not installed. Installing pm2 globally..."
|
||||||
|
sudo npm install -g pm2
|
||||||
|
echo "======>pm2 installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install lsof
|
||||||
|
install_lsof() {
|
||||||
|
echo "======>lsof is not installed. Installing lsof..."
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y lsof
|
||||||
|
echo "======>lsof installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Wait for a command to become available
|
||||||
|
wait_for_command() {
|
||||||
|
command="$1"
|
||||||
|
while ! command -v $command &> /dev/null; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Step 1: Check if sudo is installed and install if not
|
||||||
|
if ! command -v sudo &> /dev/null; then
|
||||||
|
echo "======>sudo is not installed. Installing sudo..."
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y sudo
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Check if curl is installed
|
||||||
|
if ! command -v curl &> /dev/null; then
|
||||||
|
echo "======>curl is not installed. Installing curl..."
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y curl
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 3: Check if Node.js is installed and install Node.js 16 if not
|
||||||
|
if ! command -v node &> /dev/null; then
|
||||||
|
install_node
|
||||||
|
else
|
||||||
|
echo "======>Node.js is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait for Node.js to be installed
|
||||||
|
wait_for_command node
|
||||||
|
|
||||||
|
# Step 4: Output Node.js and npm versions
|
||||||
|
node_version=$(node -v)
|
||||||
|
npm_version=$(npm -v)
|
||||||
|
echo "======>Node.js version: $node_version"
|
||||||
|
echo "======>npm version: $npm_version"
|
||||||
|
|
||||||
|
# Step 5: Check if pm2 is installed and install it globally if not
|
||||||
|
if ! command -v pm2 &> /dev/null; then
|
||||||
|
install_pm2
|
||||||
|
else
|
||||||
|
echo "======>pm2 is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait for pm2 to be installed
|
||||||
|
wait_for_command pm2
|
||||||
|
|
||||||
|
# Step 6: Check if lsof is installed and install if not
|
||||||
|
if ! command -v lsof &> /dev/null; then
|
||||||
|
install_lsof
|
||||||
|
else
|
||||||
|
echo "======>lsof is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 7: Check if ports 9092 and 8444 are occupied
|
||||||
|
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
|
||||||
|
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
|
||||||
|
|
||||||
|
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
|
||||||
|
echo "======>Port 9092 or 8444 is already in use."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Step 8: install npm packages
|
||||||
|
echo "Ready to install npm packages"
|
||||||
|
cd ../../svr/
|
||||||
|
rm package-lock.json
|
||||||
|
npm install --registry=https://registry.npmmirror.com
|
||||||
|
|
||||||
|
|
||||||
|
# Step 9: Run start-http.sh script to start the service
|
||||||
|
echo "Ready to run auto-start-http.sh"
|
||||||
|
sleep 1
|
||||||
|
/bin/bash ./../bin/ubuntu16/auto-start-http.sh
|
99
bin/ubuntu16/auto-check-install-https.sh
Executable file
99
bin/ubuntu16/auto-check-install-https.sh
Executable file
@@ -0,0 +1,99 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Function to install Node.js 16
|
||||||
|
install_node() {
|
||||||
|
echo "======>Node.js is not installed. Installing Node.js 16..."
|
||||||
|
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
|
||||||
|
sudo apt-get install -y nodejs
|
||||||
|
echo "======>Node.js 16 installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install pm2 globally
|
||||||
|
install_pm2() {
|
||||||
|
echo "======>pm2 is not installed. Installing pm2 globally..."
|
||||||
|
sudo npm install -g pm2
|
||||||
|
echo "======>pm2 installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install lsof
|
||||||
|
install_lsof() {
|
||||||
|
echo "======>lsof is not installed. Installing lsof..."
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y lsof
|
||||||
|
echo "======>lsof installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Wait for a command to become available
|
||||||
|
wait_for_command() {
|
||||||
|
command="$1"
|
||||||
|
while ! command -v $command &> /dev/null; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Step 1: Check if sudo is installed and install if not
|
||||||
|
if ! command -v sudo &> /dev/null; then
|
||||||
|
echo "======>sudo is not installed. Installing sudo..."
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y sudo
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Check if curl is installed
|
||||||
|
if ! command -v curl &> /dev/null; then
|
||||||
|
echo "======>curl is not installed. Installing curl..."
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y curl
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 3: Check if Node.js is installed and install Node.js 16 if not
|
||||||
|
if ! command -v node &> /dev/null; then
|
||||||
|
install_node
|
||||||
|
else
|
||||||
|
echo "======>Node.js is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait for Node.js to be installed
|
||||||
|
wait_for_command node
|
||||||
|
|
||||||
|
# Step 4: Output Node.js and npm versions
|
||||||
|
node_version=$(node -v)
|
||||||
|
npm_version=$(npm -v)
|
||||||
|
echo "======>Node.js version: $node_version"
|
||||||
|
echo "======>npm version: $npm_version"
|
||||||
|
|
||||||
|
# Step 5: Check if pm2 is installed and install it globally if not
|
||||||
|
if ! command -v pm2 &> /dev/null; then
|
||||||
|
install_pm2
|
||||||
|
else
|
||||||
|
echo "======>pm2 is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait for pm2 to be installed
|
||||||
|
wait_for_command pm2
|
||||||
|
|
||||||
|
# Step 6: Check if lsof is installed and install if not
|
||||||
|
if ! command -v lsof &> /dev/null; then
|
||||||
|
install_lsof
|
||||||
|
else
|
||||||
|
echo "======>lsof is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 7: Check if ports 9092 and 8444 are occupied
|
||||||
|
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
|
||||||
|
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
|
||||||
|
|
||||||
|
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
|
||||||
|
echo "======>Port 9092 or 8444 is already in use."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 8: install npm packages
|
||||||
|
echo "======>Ready to install npm packages"
|
||||||
|
cd ../../svr/
|
||||||
|
rm package-lock.json
|
||||||
|
npm install --registry=https://registry.npmmirror.com
|
||||||
|
|
||||||
|
# Step 9: Run start-https.sh script to start the service
|
||||||
|
echo "======>Ready to run auto-start-https.sh"
|
||||||
|
sleep 1
|
||||||
|
/bin/bash ./../bin/ubuntu16/auto-start-https.sh
|
@@ -1,12 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cd ../../svr/
|
|
||||||
|
|
||||||
pm2 start npm --name=tl-rtc-file-api -- run http-api
|
pm2 start npm --name=tl-rtc-file-api -- run http-api
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
pm2 start npm --name=tl-rtc-file-socket -- run http-api
|
pm2 start npm --name=tl-rtc-file-socket -- run http-socket
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
@@ -1,7 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cd ../../svr/
|
|
||||||
|
|
||||||
pm2 start npm --name=tl-rtc-file-api -- run https-api
|
pm2 start npm --name=tl-rtc-file-api -- run https-api
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
7
bin/ubuntu16/auto-stop.sh
Executable file
7
bin/ubuntu16/auto-stop.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
pm2 del tl-rtc-file-api
|
||||||
|
|
||||||
|
pm2 del tl-rtc-file-socket
|
||||||
|
|
||||||
|
echo "stop and [tl-rtc-file-api] / [tl-rtc-file-socket] pm2 processes ok"
|
101
bin/ubuntu18/auto-check-install-http.sh
Executable file
101
bin/ubuntu18/auto-check-install-http.sh
Executable file
@@ -0,0 +1,101 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Function to install Node.js 16
|
||||||
|
install_node() {
|
||||||
|
echo "======>Node.js is not installed. Installing Node.js 16..."
|
||||||
|
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
|
||||||
|
sudo apt-get install -y nodejs
|
||||||
|
echo "======>Node.js 16 installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install pm2 globally
|
||||||
|
install_pm2() {
|
||||||
|
echo "======>pm2 is not installed. Installing pm2 globally..."
|
||||||
|
sudo npm install -g pm2
|
||||||
|
echo "======>pm2 installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install lsof
|
||||||
|
install_lsof() {
|
||||||
|
echo "======>lsof is not installed. Installing lsof..."
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y lsof
|
||||||
|
echo "======>lsof installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Wait for a command to become available
|
||||||
|
wait_for_command() {
|
||||||
|
command="$1"
|
||||||
|
while ! command -v $command &> /dev/null; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Step 1: Check if sudo is installed and install if not
|
||||||
|
if ! command -v sudo &> /dev/null; then
|
||||||
|
echo "======>sudo is not installed. Installing sudo..."
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y sudo
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Check if curl is installed
|
||||||
|
if ! command -v curl &> /dev/null; then
|
||||||
|
echo "======>curl is not installed. Installing curl..."
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y curl
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 3: Check if Node.js is installed and install Node.js 16 if not
|
||||||
|
if ! command -v node &> /dev/null; then
|
||||||
|
install_node
|
||||||
|
else
|
||||||
|
echo "======>Node.js is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait for Node.js to be installed
|
||||||
|
wait_for_command node
|
||||||
|
|
||||||
|
# Step 4: Output Node.js and npm versions
|
||||||
|
node_version=$(node -v)
|
||||||
|
npm_version=$(npm -v)
|
||||||
|
echo "======>Node.js version: $node_version"
|
||||||
|
echo "======>npm version: $npm_version"
|
||||||
|
|
||||||
|
# Step 5: Check if pm2 is installed and install it globally if not
|
||||||
|
if ! command -v pm2 &> /dev/null; then
|
||||||
|
install_pm2
|
||||||
|
else
|
||||||
|
echo "======>pm2 is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait for pm2 to be installed
|
||||||
|
wait_for_command pm2
|
||||||
|
|
||||||
|
# Step 6: Check if lsof is installed and install if not
|
||||||
|
if ! command -v lsof &> /dev/null; then
|
||||||
|
install_lsof
|
||||||
|
else
|
||||||
|
echo "======>lsof is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 7: Check if ports 9092 and 8444 are occupied
|
||||||
|
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
|
||||||
|
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
|
||||||
|
|
||||||
|
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
|
||||||
|
echo "======>Port 9092 or 8444 is already in use."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Step 8: install npm packages
|
||||||
|
echo "Ready to install npm packages"
|
||||||
|
cd ../../svr/
|
||||||
|
rm package-lock.json
|
||||||
|
npm install --registry=https://registry.npmmirror.com
|
||||||
|
|
||||||
|
|
||||||
|
# Step 9: Run start-http.sh script to start the service
|
||||||
|
echo "Ready to run auto-start-http.sh"
|
||||||
|
sleep 1
|
||||||
|
/bin/bash ./../bin/ubuntu16/auto-start-http.sh
|
99
bin/ubuntu18/auto-check-install-https.sh
Executable file
99
bin/ubuntu18/auto-check-install-https.sh
Executable file
@@ -0,0 +1,99 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Function to install Node.js 16
|
||||||
|
install_node() {
|
||||||
|
echo "======>Node.js is not installed. Installing Node.js 16..."
|
||||||
|
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
|
||||||
|
sudo apt-get install -y nodejs
|
||||||
|
echo "======>Node.js 16 installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install pm2 globally
|
||||||
|
install_pm2() {
|
||||||
|
echo "======>pm2 is not installed. Installing pm2 globally..."
|
||||||
|
sudo npm install -g pm2
|
||||||
|
echo "======>pm2 installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install lsof
|
||||||
|
install_lsof() {
|
||||||
|
echo "======>lsof is not installed. Installing lsof..."
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y lsof
|
||||||
|
echo "======>lsof installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Wait for a command to become available
|
||||||
|
wait_for_command() {
|
||||||
|
command="$1"
|
||||||
|
while ! command -v $command &> /dev/null; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Step 1: Check if sudo is installed and install if not
|
||||||
|
if ! command -v sudo &> /dev/null; then
|
||||||
|
echo "======>sudo is not installed. Installing sudo..."
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y sudo
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Check if curl is installed
|
||||||
|
if ! command -v curl &> /dev/null; then
|
||||||
|
echo "======>curl is not installed. Installing curl..."
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y curl
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 3: Check if Node.js is installed and install Node.js 16 if not
|
||||||
|
if ! command -v node &> /dev/null; then
|
||||||
|
install_node
|
||||||
|
else
|
||||||
|
echo "======>Node.js is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait for Node.js to be installed
|
||||||
|
wait_for_command node
|
||||||
|
|
||||||
|
# Step 4: Output Node.js and npm versions
|
||||||
|
node_version=$(node -v)
|
||||||
|
npm_version=$(npm -v)
|
||||||
|
echo "======>Node.js version: $node_version"
|
||||||
|
echo "======>npm version: $npm_version"
|
||||||
|
|
||||||
|
# Step 5: Check if pm2 is installed and install it globally if not
|
||||||
|
if ! command -v pm2 &> /dev/null; then
|
||||||
|
install_pm2
|
||||||
|
else
|
||||||
|
echo "======>pm2 is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait for pm2 to be installed
|
||||||
|
wait_for_command pm2
|
||||||
|
|
||||||
|
# Step 6: Check if lsof is installed and install if not
|
||||||
|
if ! command -v lsof &> /dev/null; then
|
||||||
|
install_lsof
|
||||||
|
else
|
||||||
|
echo "======>lsof is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 7: Check if ports 9092 and 8444 are occupied
|
||||||
|
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
|
||||||
|
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
|
||||||
|
|
||||||
|
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
|
||||||
|
echo "======>Port 9092 or 8444 is already in use."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 8: install npm packages
|
||||||
|
echo "======>Ready to install npm packages"
|
||||||
|
cd ../../svr/
|
||||||
|
rm package-lock.json
|
||||||
|
npm install --registry=https://registry.npmmirror.com
|
||||||
|
|
||||||
|
# Step 9: Run start-https.sh script to start the service
|
||||||
|
echo "======>Ready to run auto-start-https.sh"
|
||||||
|
sleep 1
|
||||||
|
/bin/bash ./../bin/ubuntu16/auto-start-https.sh
|
11
bin/ubuntu18/auto-start-http.sh
Executable file
11
bin/ubuntu18/auto-start-http.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
pm2 start npm --name=tl-rtc-file-api -- run http-api
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
pm2 start npm --name=tl-rtc-file-socket -- run http-socket
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
npm run build:pro
|
11
bin/ubuntu18/auto-start-https.sh
Executable file
11
bin/ubuntu18/auto-start-https.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
pm2 start npm --name=tl-rtc-file-api -- run https-api
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
pm2 start npm --name=tl-rtc-file-socket -- run https-socket
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
npm run build:pro
|
7
bin/ubuntu18/auto-stop.sh
Executable file
7
bin/ubuntu18/auto-stop.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
pm2 del tl-rtc-file-api
|
||||||
|
|
||||||
|
pm2 del tl-rtc-file-socket
|
||||||
|
|
||||||
|
echo "stop and [tl-rtc-file-api] / [tl-rtc-file-socket] pm2 processes ok"
|
101
bin/ubuntu20/auto-check-install-http.sh
Executable file
101
bin/ubuntu20/auto-check-install-http.sh
Executable file
@@ -0,0 +1,101 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Function to install Node.js 16
|
||||||
|
install_node() {
|
||||||
|
echo "======>Node.js is not installed. Installing Node.js 16..."
|
||||||
|
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
|
||||||
|
sudo apt-get install -y nodejs
|
||||||
|
echo "======>Node.js 16 installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install pm2 globally
|
||||||
|
install_pm2() {
|
||||||
|
echo "======>pm2 is not installed. Installing pm2 globally..."
|
||||||
|
sudo npm install -g pm2
|
||||||
|
echo "======>pm2 installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install lsof
|
||||||
|
install_lsof() {
|
||||||
|
echo "======>lsof is not installed. Installing lsof..."
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y lsof
|
||||||
|
echo "======>lsof installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Wait for a command to become available
|
||||||
|
wait_for_command() {
|
||||||
|
command="$1"
|
||||||
|
while ! command -v $command &> /dev/null; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Step 1: Check if sudo is installed and install if not
|
||||||
|
if ! command -v sudo &> /dev/null; then
|
||||||
|
echo "======>sudo is not installed. Installing sudo..."
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y sudo
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Check if curl is installed
|
||||||
|
if ! command -v curl &> /dev/null; then
|
||||||
|
echo "======>curl is not installed. Installing curl..."
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y curl
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 3: Check if Node.js is installed and install Node.js 16 if not
|
||||||
|
if ! command -v node &> /dev/null; then
|
||||||
|
install_node
|
||||||
|
else
|
||||||
|
echo "======>Node.js is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait for Node.js to be installed
|
||||||
|
wait_for_command node
|
||||||
|
|
||||||
|
# Step 4: Output Node.js and npm versions
|
||||||
|
node_version=$(node -v)
|
||||||
|
npm_version=$(npm -v)
|
||||||
|
echo "======>Node.js version: $node_version"
|
||||||
|
echo "======>npm version: $npm_version"
|
||||||
|
|
||||||
|
# Step 5: Check if pm2 is installed and install it globally if not
|
||||||
|
if ! command -v pm2 &> /dev/null; then
|
||||||
|
install_pm2
|
||||||
|
else
|
||||||
|
echo "======>pm2 is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait for pm2 to be installed
|
||||||
|
wait_for_command pm2
|
||||||
|
|
||||||
|
# Step 6: Check if lsof is installed and install if not
|
||||||
|
if ! command -v lsof &> /dev/null; then
|
||||||
|
install_lsof
|
||||||
|
else
|
||||||
|
echo "======>lsof is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 7: Check if ports 9092 and 8444 are occupied
|
||||||
|
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
|
||||||
|
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
|
||||||
|
|
||||||
|
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
|
||||||
|
echo "======>Port 9092 or 8444 is already in use."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Step 8: install npm packages
|
||||||
|
echo "Ready to install npm packages"
|
||||||
|
cd ../../svr/
|
||||||
|
rm package-lock.json
|
||||||
|
npm install --registry=https://registry.npmmirror.com
|
||||||
|
|
||||||
|
|
||||||
|
# Step 9: Run start-http.sh script to start the service
|
||||||
|
echo "Ready to run auto-start-http.sh"
|
||||||
|
sleep 1
|
||||||
|
/bin/bash ./../bin/ubuntu16/auto-start-http.sh
|
99
bin/ubuntu20/auto-check-install-https.sh
Executable file
99
bin/ubuntu20/auto-check-install-https.sh
Executable file
@@ -0,0 +1,99 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Function to install Node.js 16
|
||||||
|
install_node() {
|
||||||
|
echo "======>Node.js is not installed. Installing Node.js 16..."
|
||||||
|
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
|
||||||
|
sudo apt-get install -y nodejs
|
||||||
|
echo "======>Node.js 16 installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install pm2 globally
|
||||||
|
install_pm2() {
|
||||||
|
echo "======>pm2 is not installed. Installing pm2 globally..."
|
||||||
|
sudo npm install -g pm2
|
||||||
|
echo "======>pm2 installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install lsof
|
||||||
|
install_lsof() {
|
||||||
|
echo "======>lsof is not installed. Installing lsof..."
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y lsof
|
||||||
|
echo "======>lsof installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Wait for a command to become available
|
||||||
|
wait_for_command() {
|
||||||
|
command="$1"
|
||||||
|
while ! command -v $command &> /dev/null; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Step 1: Check if sudo is installed and install if not
|
||||||
|
if ! command -v sudo &> /dev/null; then
|
||||||
|
echo "======>sudo is not installed. Installing sudo..."
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y sudo
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Check if curl is installed
|
||||||
|
if ! command -v curl &> /dev/null; then
|
||||||
|
echo "======>curl is not installed. Installing curl..."
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y curl
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 3: Check if Node.js is installed and install Node.js 16 if not
|
||||||
|
if ! command -v node &> /dev/null; then
|
||||||
|
install_node
|
||||||
|
else
|
||||||
|
echo "======>Node.js is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait for Node.js to be installed
|
||||||
|
wait_for_command node
|
||||||
|
|
||||||
|
# Step 4: Output Node.js and npm versions
|
||||||
|
node_version=$(node -v)
|
||||||
|
npm_version=$(npm -v)
|
||||||
|
echo "======>Node.js version: $node_version"
|
||||||
|
echo "======>npm version: $npm_version"
|
||||||
|
|
||||||
|
# Step 5: Check if pm2 is installed and install it globally if not
|
||||||
|
if ! command -v pm2 &> /dev/null; then
|
||||||
|
install_pm2
|
||||||
|
else
|
||||||
|
echo "======>pm2 is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait for pm2 to be installed
|
||||||
|
wait_for_command pm2
|
||||||
|
|
||||||
|
# Step 6: Check if lsof is installed and install if not
|
||||||
|
if ! command -v lsof &> /dev/null; then
|
||||||
|
install_lsof
|
||||||
|
else
|
||||||
|
echo "======>lsof is already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 7: Check if ports 9092 and 8444 are occupied
|
||||||
|
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
|
||||||
|
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
|
||||||
|
|
||||||
|
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
|
||||||
|
echo "======>Port 9092 or 8444 is already in use."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 8: install npm packages
|
||||||
|
echo "======>Ready to install npm packages"
|
||||||
|
cd ../../svr/
|
||||||
|
rm package-lock.json
|
||||||
|
npm install --registry=https://registry.npmmirror.com
|
||||||
|
|
||||||
|
# Step 9: Run start-https.sh script to start the service
|
||||||
|
echo "======>Ready to run auto-start-https.sh"
|
||||||
|
sleep 1
|
||||||
|
/bin/bash ./../bin/ubuntu16/auto-start-https.sh
|
11
bin/ubuntu20/auto-start-http.sh
Executable file
11
bin/ubuntu20/auto-start-http.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
pm2 start npm --name=tl-rtc-file-api -- run http-api
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
pm2 start npm --name=tl-rtc-file-socket -- run http-socket
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
npm run build:pro
|
11
bin/ubuntu20/auto-start-https.sh
Executable file
11
bin/ubuntu20/auto-start-https.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
pm2 start npm --name=tl-rtc-file-api -- run https-api
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
pm2 start npm --name=tl-rtc-file-socket -- run https-socket
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
npm run build:pro
|
7
bin/ubuntu20/auto-stop.sh
Executable file
7
bin/ubuntu20/auto-stop.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
pm2 del tl-rtc-file-api
|
||||||
|
|
||||||
|
pm2 del tl-rtc-file-socket
|
||||||
|
|
||||||
|
echo "stop and [tl-rtc-file-api] / [tl-rtc-file-socket] pm2 processes ok"
|
@@ -1,51 +1,104 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
:: Function to install Node.js 16
|
||||||
|
:install_node
|
||||||
|
echo ======>Node.js is not installed. Installing Node.js 16...
|
||||||
|
curl -sL https://deb.nodesource.com/setup_16.x | bash -
|
||||||
|
msiexec /i nodejs-installer.msi /qn
|
||||||
|
echo ======>Node.js 16 installed
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
:: Function to install pm2 globally
|
||||||
|
:install_pm2
|
||||||
|
echo ======>pm2 is not installed. Installing pm2 globally...
|
||||||
|
npm install -g pm2
|
||||||
|
echo ======>pm2 installed
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
:: Function to install lsof
|
||||||
|
:install_lsof
|
||||||
|
echo ======>lsof is not installed. Installing lsof...
|
||||||
|
:: Assuming lsof equivalent is not available on Windows by default
|
||||||
|
echo ======>lsof installed
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
:: Wait for a command to become available
|
||||||
|
:wait_for_command
|
||||||
setlocal
|
setlocal
|
||||||
|
set "command=%~1"
|
||||||
|
set "timeout=10"
|
||||||
|
:loop
|
||||||
|
timeout /t %timeout% /nobreak >nul
|
||||||
|
where %command% >nul 2>&1 || goto :loop
|
||||||
|
endlocal
|
||||||
|
goto :eof
|
||||||
|
|
||||||
REM Step 1: Check if Node.js is installed and install Node.js 18 if not
|
:: Step 1: Check if sudo is installed and install if not
|
||||||
where /q node
|
where sudo >nul 2>&1 || (
|
||||||
if %ERRORLEVEL% NEQ 0 (
|
echo ======>sudo is not installed. Installing sudo...
|
||||||
echo Node.js is not installed. Installing Node.js 18...
|
REM Install a sudo equivalent for Windows (e.g., Chocolatey's sudo)
|
||||||
REM Modify the Node.js installer URL if needed
|
choco install sudo
|
||||||
curl -o node_installer.msi https://nodejs.org/dist/v18.0.0/node-v18.0.0-x64.msi
|
|
||||||
start /wait msiexec /i node_installer.msi /qn
|
|
||||||
del node_installer.msi
|
|
||||||
)
|
)
|
||||||
|
|
||||||
REM Step 2: Output Node.js and npm versions
|
:: Step 2: Check if curl is installed
|
||||||
node -v
|
where curl >nul 2>&1 || (
|
||||||
npm -v
|
echo ======>curl is not installed. Installing curl...
|
||||||
|
REM Install curl using Chocolatey or other means
|
||||||
REM Step 3: Check if pm2 is installed and install it globally if not
|
|
||||||
where /q pm2
|
|
||||||
if %ERRORLEVEL% NEQ 0 (
|
|
||||||
echo pm2 is not installed. Installing pm2 globally...
|
|
||||||
npm install -g pm2
|
|
||||||
)
|
)
|
||||||
|
|
||||||
REM Step 4: Output pm2 version
|
:: Step 3: Check if Node.js is installed and install Node.js 16 if not
|
||||||
pm2 -v
|
where node >nul 2>&1 || (
|
||||||
|
call :install_node
|
||||||
|
) else (
|
||||||
|
echo ======>Node.js is already installed
|
||||||
|
)
|
||||||
|
|
||||||
REM Step 5: Check if ports 9092 and 8444 are occupied
|
:: Wait for Node.js to be installed
|
||||||
netstat -ano | findstr ":9092"
|
call :wait_for_command node
|
||||||
if %ERRORLEVEL% EQU 0 (
|
|
||||||
echo Port 9092 is already in use.
|
:: Step 4: Output Node.js and npm versions
|
||||||
|
for /f %%i in ('node -v') do set "node_version=%%i"
|
||||||
|
for /f %%i in ('npm -v') do set "npm_version=%%i"
|
||||||
|
echo ======>Node.js version: %node_version%
|
||||||
|
echo ======>npm version: %npm_version%
|
||||||
|
|
||||||
|
:: Step 5: Check if pm2 is installed and install it globally if not
|
||||||
|
where pm2 >nul 2>&1 || (
|
||||||
|
call :install_pm2
|
||||||
|
) else (
|
||||||
|
echo ======>pm2 is already installed
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Wait for pm2 to be installed
|
||||||
|
call :wait_for_command pm2
|
||||||
|
|
||||||
|
:: Step 6: Check if lsof is installed and install if not
|
||||||
|
where lsof >nul 2>&1 || (
|
||||||
|
call :install_lsof
|
||||||
|
) else (
|
||||||
|
echo ======>lsof is already installed
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Step 7: Check if ports 9092 and 8444 are occupied
|
||||||
|
REM Equivalent check for port occupancy on Windows
|
||||||
|
netstat -an | find "9092" >nul && (
|
||||||
|
echo ======>Port 9092 is already in use.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
netstat -an | find "8444" >nul && (
|
||||||
|
echo ======>Port 8444 is already in use.
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
|
|
||||||
netstat -ano | findstr ":8444"
|
:: Step 8: install npm packages
|
||||||
if %ERRORLEVEL% EQU 0 (
|
echo Ready to install npm packages
|
||||||
echo Port 8444 is already in use.
|
cd ..\..\svr\
|
||||||
exit /b 1
|
del package-lock.json
|
||||||
)
|
|
||||||
|
|
||||||
REM Step 6: Output installation successful message
|
|
||||||
echo env Installation successful.
|
|
||||||
|
|
||||||
@echo off
|
|
||||||
echo "ready to install npm packages"
|
|
||||||
cd "..\..\svr\"
|
|
||||||
npm install --registry=https://registry.npmmirror.com
|
npm install --registry=https://registry.npmmirror.com
|
||||||
cd "..\bin\windows\"
|
|
||||||
|
|
||||||
REM Step 7: Run start-http.bat script to start the service
|
:: Step 9: Run start-http.bat script to start the service
|
||||||
auto-start-http.bat
|
echo Ready to run auto-start-http.bat
|
||||||
|
timeout /t 1 >nul
|
||||||
|
call ..\bin\windows\auto-start-http.bat
|
||||||
|
|
||||||
|
:eof
|
@@ -1,51 +1,104 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
:: Function to install Node.js 16
|
||||||
|
:install_node
|
||||||
|
echo ======>Node.js is not installed. Installing Node.js 16...
|
||||||
|
curl -sL https://deb.nodesource.com/setup_16.x | bash -
|
||||||
|
msiexec /i nodejs-installer.msi /qn
|
||||||
|
echo ======>Node.js 16 installed
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
:: Function to install pm2 globally
|
||||||
|
:install_pm2
|
||||||
|
echo ======>pm2 is not installed. Installing pm2 globally...
|
||||||
|
npm install -g pm2
|
||||||
|
echo ======>pm2 installed
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
:: Function to install lsof
|
||||||
|
:install_lsof
|
||||||
|
echo ======>lsof is not installed. Installing lsof...
|
||||||
|
:: Assuming lsof equivalent is not available on Windows by default
|
||||||
|
echo ======>lsof installed
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
:: Wait for a command to become available
|
||||||
|
:wait_for_command
|
||||||
setlocal
|
setlocal
|
||||||
|
set "command=%~1"
|
||||||
|
set "timeout=10"
|
||||||
|
:loop
|
||||||
|
timeout /t %timeout% /nobreak >nul
|
||||||
|
where %command% >nul 2>&1 || goto :loop
|
||||||
|
endlocal
|
||||||
|
goto :eof
|
||||||
|
|
||||||
REM Step 1: Check if Node.js is installed and install Node.js 18 if not
|
:: Step 1: Check if sudo is installed and install if not
|
||||||
where /q node
|
where sudo >nul 2>&1 || (
|
||||||
if %ERRORLEVEL% NEQ 0 (
|
echo ======>sudo is not installed. Installing sudo...
|
||||||
echo Node.js is not installed. Installing Node.js 18...
|
REM Install a sudo equivalent for Windows (e.g., Chocolatey's sudo)
|
||||||
REM Modify the Node.js installer URL if needed
|
choco install sudo
|
||||||
curl -o node_installer.msi https://nodejs.org/dist/v18.0.0/node-v18.0.0-x64.msi
|
|
||||||
start /wait msiexec /i node_installer.msi /qn
|
|
||||||
del node_installer.msi
|
|
||||||
)
|
)
|
||||||
|
|
||||||
REM Step 2: Output Node.js and npm versions
|
:: Step 2: Check if curl is installed
|
||||||
node -v
|
where curl >nul 2>&1 || (
|
||||||
npm -v
|
echo ======>curl is not installed. Installing curl...
|
||||||
|
REM Install curl using Chocolatey or other means
|
||||||
REM Step 3: Check if pm2 is installed and install it globally if not
|
|
||||||
where /q pm2
|
|
||||||
if %ERRORLEVEL% NEQ 0 (
|
|
||||||
echo pm2 is not installed. Installing pm2 globally...
|
|
||||||
npm install -g pm2
|
|
||||||
)
|
)
|
||||||
|
|
||||||
REM Step 4: Output pm2 version
|
:: Step 3: Check if Node.js is installed and install Node.js 16 if not
|
||||||
pm2 -v
|
where node >nul 2>&1 || (
|
||||||
|
call :install_node
|
||||||
|
) else (
|
||||||
|
echo ======>Node.js is already installed
|
||||||
|
)
|
||||||
|
|
||||||
REM Step 5: Check if ports 9092 and 8444 are occupied
|
:: Wait for Node.js to be installed
|
||||||
netstat -ano | findstr ":9092"
|
call :wait_for_command node
|
||||||
if %ERRORLEVEL% EQU 0 (
|
|
||||||
echo Port 9092 is already in use.
|
:: Step 4: Output Node.js and npm versions
|
||||||
|
for /f %%i in ('node -v') do set "node_version=%%i"
|
||||||
|
for /f %%i in ('npm -v') do set "npm_version=%%i"
|
||||||
|
echo ======>Node.js version: %node_version%
|
||||||
|
echo ======>npm version: %npm_version%
|
||||||
|
|
||||||
|
:: Step 5: Check if pm2 is installed and install it globally if not
|
||||||
|
where pm2 >nul 2>&1 || (
|
||||||
|
call :install_pm2
|
||||||
|
) else (
|
||||||
|
echo ======>pm2 is already installed
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Wait for pm2 to be installed
|
||||||
|
call :wait_for_command pm2
|
||||||
|
|
||||||
|
:: Step 6: Check if lsof is installed and install if not
|
||||||
|
where lsof >nul 2>&1 || (
|
||||||
|
call :install_lsof
|
||||||
|
) else (
|
||||||
|
echo ======>lsof is already installed
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Step 7: Check if ports 9092 and 8444 are occupied
|
||||||
|
REM Equivalent check for port occupancy on Windows
|
||||||
|
netstat -an | find "9092" >nul && (
|
||||||
|
echo ======>Port 9092 is already in use.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
netstat -an | find "8444" >nul && (
|
||||||
|
echo ======>Port 8444 is already in use.
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
|
|
||||||
netstat -ano | findstr ":8444"
|
:: Step 8: install npm packages
|
||||||
if %ERRORLEVEL% EQU 0 (
|
echo Ready to install npm packages
|
||||||
echo Port 8444 is already in use.
|
cd ..\..\svr\
|
||||||
exit /b 1
|
del package-lock.json
|
||||||
)
|
|
||||||
|
|
||||||
REM Step 6: Output installation successful message
|
|
||||||
echo env Installation successful.
|
|
||||||
|
|
||||||
@echo off
|
|
||||||
echo "ready to install npm packages"
|
|
||||||
cd "..\..\svr\"
|
|
||||||
npm install --registry=https://registry.npmmirror.com
|
npm install --registry=https://registry.npmmirror.com
|
||||||
cd "..\bin\windows\"
|
|
||||||
|
|
||||||
REM Step 7: Run start-https.bat script to start the service
|
:: Step 9: Run start-https.bat script to start the service
|
||||||
auto-start-https.bat
|
echo Ready to run auto-start-https.bat
|
||||||
|
timeout /t 1 >nul
|
||||||
|
call ..\bin\windows\auto-start-https.bat
|
||||||
|
|
||||||
|
:eof
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
cd "..\..\svr\"
|
|
||||||
|
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
REM Start the first process
|
REM Start the first process
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
cd "..\..\svr\"
|
|
||||||
|
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
REM Start the first process
|
REM Start the first process
|
||||||
|
Reference in New Issue
Block a user