title: Nexus 3 Repository Manager Create (Or Run Pre-generated) Task Without Using User Interface
body: <p>This question arose when I was trying to reboot my Nexus3 container on a weekly schedule and connect to an S3 bucket I have. I have my container set up to connect to the S3 bucket just fine (it creates a new <code>[A-Z,0-9]-metrics.properties</code> file each time) but the previous artifacts are not found when looking though the UI.</p>
  
  <p>I used the <code>Repair - Reconcile component database from blob store</code> task from the UI settings and it works great! </p>
  
  <p>But... all the previous steps are done automatically through scripts and I would like the same for the final step of <em>Reconciling the blob store</em>.</p>
  
  <p>Connecting to the S3 blob store is done with reference to examples from <a href="https://github.com/sonatype/nexus-book-examples/tree/nexus-3.x/scripting" rel="nofollow noreferrer">nexus-book-examples</a>. As below:</p>
  
  <pre><code>Map&lt;String, String&gt; config = new HashMap&lt;&gt;()
  config.put("bucket", "nexus-artifact-storage")
  blobStore.createS3BlobStore('nexus-artifact-storage', config)
  </code></pre>
  
  <p>AWS credentials are provided during the <code>docker run</code> step so the above is all that is needed for the blob store set up. It is called by a modified version of <a href="https://github.com/sonatype/nexus-book-examples/blob/nexus-3.x/scripting/complex-script/provision.sh" rel="nofollow noreferrer">provision.sh</a>, which is a script from the nexus-book-examples git page.</p>
  
  <p>Is there a way to either:</p>
  
  <ol>
  <li>Create a task with a groovy script? or,</li>
  <li>Reference one of the task types and run the task that way with a POST?</li>
  </ol>