-package jp.co.areaweb.tools.command;
-import java.io.*;
-
-public class Job
-{
- public static final boolean debug = false;
-
- public static void execJob(File jobFile) throws IOException {
- execJob(jobFile, null);
- }
-
- public static void execJob(File jobFile, File workDir) throws IOException {
- if (jobFile == null) {
- throw new IOException("実行するジョブファイルが指定されていません。");
- }
- if (debug) {
- System.out.println("[s JobFile] " + jobFile.getName());
- }
-
- FileInputStream fis = new FileInputStream(jobFile);
- BufferedReader dis = new BufferedReader(new InputStreamReader(fis));
- String commandLine;
- Command command = new Command();
- while((commandLine = dis.readLine()) != null) {
- command.setCmd(commandLine);
- command.setWorkDir(workDir);
- command.execCommand();
- System.out.println(command.getOutput());
- }
-
- if (debug) {
- System.out.println("[e JobFile] " + jobFile.getName());
- }
- }
-
- /**
- * サンプル
- */
- static public void main(String[] args) {
- if (args.length < 1) {
- System.out.println("exp: java jp.co.areaweb.tools.command.Job [jobFileName]");
- return;
- }
-
- try {
- Job.execJob(new File(args[0]), null);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
+package jp.co.areaweb.tools.command;\r
+import java.io.*;\r
+\r
+public class Job\r
+{\r
+ public static final boolean debug = false;\r
+\r
+ public static void execJob(File jobFile) throws IOException {\r
+ execJob(jobFile, null);\r
+ }\r
+\r
+ public static void execJob(File jobFile, File workDir) throws IOException {\r
+ if (jobFile == null) {\r
+ throw new IOException("実行するジョブファイルが指定されていません。");\r
+ }\r
+ if (debug) {\r
+ System.out.println("[s JobFile] " + jobFile.getName());\r
+ }\r
+\r
+ FileInputStream fis = new FileInputStream(jobFile);\r
+ BufferedReader dis = new BufferedReader(new InputStreamReader(fis));\r
+ String commandLine;\r
+ Command command = new Command();\r
+ while((commandLine = dis.readLine()) != null) {\r
+ command.setCmd(commandLine);\r
+ command.setWorkDir(workDir);\r
+ command.execCommand();\r
+ System.out.println(command.getOutput());\r
+ }\r
+\r
+ if (debug) {\r
+ System.out.println("[e JobFile] " + jobFile.getName());\r
+ }\r
+ dis.close();\r
+ }\r
+\r
+ /** \r
+ * サンプル\r
+ */\r
+ static public void main(String[] args) {\r
+ if (args.length < 1) {\r
+ System.out.println("exp: java jp.co.areaweb.tools.command.Job [jobFileName]");\r
+ return;\r
+ }\r
+\r
+ try {\r
+ Job.execJob(new File(args[0]), null);\r
+ }\r
+ catch (Exception e) {\r
+ e.printStackTrace();\r
+ }\r
+ }\r
+}\r