1 package jp.co.areaweb.tools.command;
\r
6 public static final boolean debug = false;
\r
8 public static void execJob(File jobFile) throws IOException {
\r
9 execJob(jobFile, null);
\r
12 public static void execJob(File jobFile, File workDir) throws IOException {
\r
13 if (jobFile == null) {
\r
14 throw new IOException("実行するジョブファイルが指定されていません。");
\r
17 System.out.println("[s JobFile] " + jobFile.getName());
\r
20 FileInputStream fis = new FileInputStream(jobFile);
\r
21 BufferedReader dis = new BufferedReader(new InputStreamReader(fis));
\r
23 Command command = new Command();
\r
24 while((commandLine = dis.readLine()) != null) {
\r
25 command.setCmd(commandLine);
\r
26 command.setWorkDir(workDir);
\r
27 command.execCommand();
\r
28 System.out.println(command.getOutput());
\r
32 System.out.println("[e JobFile] " + jobFile.getName());
\r
40 static public void main(String[] args) {
\r
41 if (args.length < 1) {
\r
42 System.out.println("exp: java jp.co.areaweb.tools.command.Job [jobFileName]");
\r
47 Job.execJob(new File(args[0]), null);
\r
49 catch (Exception e) {
\r
50 e.printStackTrace();
\r