7fce85fd1fb846cdb114ce3ecde3d56be66bab9f
[mir.git] / source / mir / misc / Helper.java
1 package mir.misc;
2
3 import java.io.IOException;
4
5 /**
6  * Title:        Indy
7  * Description:  This class provides some satic help methods
8  * Copyright:    Copyright (c) 2001
9  * Company:      indymedia.de
10  * @author idfx
11  * @version 1.0
12  */
13
14 public class Helper {
15
16   /**
17    * rsync the webrepository
18    * needs a rsyncscript
19    * returns the exit-code
20          * returns 255 if rsync should not be used
21    */
22   public static int rsync(){
23                 if(!MirConfig.getProp("Rsync").toLowerCase().equals("yes")){
24                         return 255;
25                 }
26                 
27           Process p;
28     int returnValue = -1;
29     try {
30       Runtime run = Runtime.getRuntime();
31       p = run.exec(MirConfig.getProp("Rsync.Script.Path"));
32       returnValue = p.waitFor();
33     } catch (IOException e) {
34       return returnValue;
35     } catch (InterruptedException e) {
36       return returnValue;
37     }
38     return returnValue;
39   }
40 }