aigems commited on
Commit
71849a1
·
1 Parent(s): 495bfe4
Files changed (2) hide show
  1. app.js +3 -0
  2. start.sh +11 -1
app.js CHANGED
@@ -11,6 +11,9 @@ app.get('/', (req, res) => {
11
  res.sendFile(__dirname + '/public/index.html');
12
  });
13
 
 
 
 
14
  // SSH 命令执行
15
  app.post('/ssh', async (req, res) => {
16
  const conn = new Client();
 
11
  res.sendFile(__dirname + '/public/index.html');
12
  });
13
 
14
+ app.get('/ssh', (req, res) => {
15
+ res.send('SSH 服务正在运行。请使用 POST 请求来执行命令。');
16
+ });
17
  // SSH 命令执行
18
  app.post('/ssh', async (req, res) => {
19
  const conn = new Client();
start.sh CHANGED
@@ -1,6 +1,8 @@
1
  #!/bin/bash
2
 
3
  echo "===== Application Startup at $(date) ====="
 
 
4
 
5
  echo "===== System Information ====="
6
  uname -a
@@ -45,4 +47,12 @@ netstat -tuln | grep LISTEN
45
 
46
  # 启动 Node.js 应用
47
  echo "Starting Node.js application..."
48
- npm start
 
 
 
 
 
 
 
 
 
1
  #!/bin/bash
2
 
3
  echo "===== Application Startup at $(date) ====="
4
+ whoami
5
+ cat /etc/passwd
6
 
7
  echo "===== System Information ====="
8
  uname -a
 
47
 
48
  # 启动 Node.js 应用
49
  echo "Starting Node.js application..."
50
+ npm start
51
+
52
+ # 检查 Node.js 应用是否成功启动
53
+ if ! pgrep -f "node app.js" > /dev/null; then
54
+ echo "Failed to start Node.js application"
55
+ exit 1
56
+ fi
57
+
58
+ echo "Node.js application started successfully"