Commit aff86ca4 authored by shulidong's avatar shulidong

标准查新手动脚本

parent ba3488c5
......@@ -27,7 +27,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
/**
......@@ -120,8 +123,22 @@ public class ChinastdController {
@PostMapping("/run/sh")
@ApiOperation("手动触发更新")
public void run() throws IOException {
final String shUrl = "/usr/bin/python3 /opt/chinastd_spider.py";
Runtime.getRuntime().exec(shUrl);
/*final String shUrl = "/usr/bin/python3 /opt/chinastd_spider.py";
Runtime.getRuntime().exec(shUrl);*/
try {
Process pro = Runtime.getRuntime().exec("/opt/chinastd_spider.sh");
InputStream in = pro.getInputStream();
BufferedReader read = new BufferedReader(new InputStreamReader(in));
String line = null;
while((line = read.readLine())!=null){
System.out.println("#################标准查新"+line);
}
pro.waitFor();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment