hsb 1 year ago
commit
287104eaf7
3 changed files with 38 additions and 0 deletions
  1. 16 0
      package.json
  2. 18 0
      src/blog.js
  3. 4 0
      src/blog.sh

+ 16 - 0
package.json

@@ -0,0 +1,16 @@
+{
+  "name": "shell_tools",
+  "version": "1.0.0",
+  "description": "",
+  "main": "index.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "repository": {
+    "type": "git",
+    "url": "http://47.90.83.132:3000/root/shell_tools.git"
+  },
+  "keywords": [],
+  "author": "",
+  "license": "ISC"
+}

+ 18 - 0
src/blog.js

@@ -0,0 +1,18 @@
+const http = require('http');
+const ps = require('child_process');
+
+// 端口
+let port = 5900;
+
+http.createServer((req, res) => {
+  let url  =  req.url;
+  if(url.indexOf("/blog") != -1)
+  {
+    let proc = ps.exec("blog.sh");
+    proc.stdout.pipe(process.stdout);
+    proc.stderr.pipe(process.stderr);
+    res.end("ok");
+  }
+}).listen(port, ()=>{
+  console.log(`start node server:${port}`);
+})

+ 4 - 0
src/blog.sh

@@ -0,0 +1,4 @@
+#! /bin/bash
+
+cd /usr/share/nginx/html/blog
+git pull