代码如下:
public class CurlToAzkaban{
public static void scheduleExecute(String flow, String cronExpression) throws IOException {
//0 23/30 5,7-10 ? * 6#3
// String command = "bash /Users/peilongcheng/gitcode/GitAzkaban/src/main/java/com/maihaoche/baiyan/shell/azkaban_schedule.sh " +flow +" \""+cronExpression+"\" "+CurlToAzkaban.getAuthenticate();
Process process = null;
Runtime runTime = Runtime.getRuntime();
//这里用commands是为了解决空格问题
String[] commands = new String[]{"/Users/peilongcheng/gitcode/GitAzkaban/src/main/java/com/maihaoche/baiyan/shell/azkaban_schedule.sh",flow,cronExpression,CurlToAzkaban.getAuthenticate() };
process = runTime.exec(commands);
try {
process.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
// 定义shell返回值
StringBuffer result &