title: How can I resubmit Oozi Coordinator by changing the start and end date?
body: <p>Is there any way to <strong>resubmit coordinator</strong> of Oozie in <em>hue</em>?</p>
  
  <p>I have one coordinator that run everyday from 1-1-2016 to 30-1-2016. </p>
  
  <p>Now, I want to change date dynamically from 1-2-2016 to 28-2-2016. </p>
  
  <p>Is there any way to dynamically change start and end date without stopping the coordinator to throw Java code or any other way? </p>
  
  <p>The following is my Java code, but it is not working - PUT Request gives me an error                                                                             </p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.OutputStreamWriter;
  import java.net.HttpURLConnection;
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.text.SimpleDateFormat;
  import java.util.Calendar;
  import java.util.Date;
  import java.util.TimeZone;
  
  import com.google.gson.Gson;
  import com.google.gson.JsonObject;
  
  public class JobSchedule {
      public static void main(String arg[]) throws Exception {
  
          // oozie.coord.application.path
          // hdfs://nameservice1/user/hue/oozie/workspaces/hue-oozie-1464585998.59
  
          // String GetData =
          // "curl -XGET http://localhost:11000/oozie/v2/job/0021784-160502160551671-oozie-oozi-C?show=info&amp;timezone=UTC";
          HttpURLConnection connection = null;
          String request = "http://localhost:11000/oozie/v2/job/0023481-160502160551671-oozie-oozi-C?show=info&amp;timezone=UTC";
          URL url = new URL(request);
          StringBuffer output = new StringBuffer();
          Date End = null;
          Date start = null;
          try {
              connection = (HttpURLConnection) url.openConnection();
              connection.setDoOutput(true);
              connection.setDoInput(true);
              connection.setInstanceFollowRedirects(false);
              connection.setRequestMethod("GET");
              connection.setRequestProperty("Content-Type", "application/json");
              connection.setRequestProperty("charset", "utf-8");
              // connection.setUseCaches(false);
              Gson gson = new Gson();
  
              OutputStreamWriter osw = new OutputStreamWriter(connection.getOutputStream());
              osw.write(request);
              osw.flush();
  
              BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
  
              String line = "";
  
              while ((line = reader.readLine()) != null) {
                  output.append(line + "\n");
              }
  
              osw.close();
              reader.close();
              JsonObject jsonObject = (JsonObject) gson.fromJson(output.toString(), JsonObject.class);
              String Ed = jsonObject.get("endTime").toString();
              End = new Date(Ed);
              String Sd = jsonObject.get("startTime").toString();
              start = new Date(Sd);
  
          } catch (Exception e) {
              e.printStackTrace();
          }
          connection.disconnect();
  
          String Data = null;
  
          Calendar sc = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
          SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd'T'00:00:ss.SSSzzz");
          sc.set(Calendar.DAY_OF_MONTH, 1);
          sf.setTimeZone(TimeZone.getTimeZone("UTC"));
          String strt = sf.format(sc.getTime());
          // TimeZone utc = TimeZone.getTimeZone("UTC");
          // sf.setTimeZone(utc);
          // Date d=new Date(sf.format(sc.getTime()));
          System.out.println("Start Date :" + strt);
          SimpleDateFormat sf1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSzzz");
  
          Calendar ec = Calendar.getInstance();
          ec.set(Calendar.DAY_OF_MONTH, ec.getActualMaximum(Calendar.DAY_OF_MONTH));
          String end = sf1.format(ec.getTime());
          System.out.println("End Date :" + end);
          // Data =
          // "PUT /oozie/v2/job/0023481-160502160551671-oozie-oozi-C?action=coord-rerun&amp;type="
          // + strt + "::" + end + "&amp;scope=&amp;refresh=false&amp;nocleanup=false";
          if (End.before(new Date()) == true) {
  
              URL url1 = null;
              try {
                  url1 = new URL("http:localhost:11000/oozie/v2/job/0023481-160502160551671-oozie-oozi-C?action=coord-rerun&amp;type=date" + strt + "::" + end + "&amp;scope=&amp;refresh=false&amp;nocleanup=false");
                  HttpURLConnection hurl = (HttpURLConnection) url1.openConnection();
                  hurl.setRequestMethod("PUT");
                  hurl.setDoOutput(true);
                  // hurl.setRequestProperty("Content-Type", "application/json");
  
                  // String payload = "";
  
                  // OutputStreamWriter os = new
                  // OutputStreamWriter(hurl.getOutputStream());
                  // os.write();
                  // os.flush();
                  // os.close();
  
              } catch (MalformedURLException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  
              // connection.setUseCaches(false);
          }
      }
  }
  </code></pre>