<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Script running at Server startup in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/script-running-at-server-startup/m-p/324755#M11756</link>
    <description>&lt;P&gt;Hi Gregory, I created a more specific event handler and I resolved the problem. Thanks Mark&lt;/P&gt;</description>
    <pubDate>Fri, 21 Aug 2020 13:50:44 GMT</pubDate>
    <dc:creator>Mark_Lumsden</dc:creator>
    <dc:date>2020-08-21T13:50:44Z</dc:date>
    <item>
      <title>Script running at Server startup</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/script-running-at-server-startup/m-p/324753#M11754</link>
      <description>&lt;P&gt;Hi,
I am testing automation and have created a script that I am using for testing&lt;/P&gt;
&lt;P&gt;function run(input, params) {&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Console.log("Creating NEWDOC");
var root = Repository.GetDocument(null, {
    "value" : "/"
});
var newDoc = Document.Create(root, {
    "type" : "File",
    "name" : "newDoc",
    "properties" : {
        "dc:title" : "NEWDOC",
        "dc:description" : "This is a new NEWDOC."
    }
});

return newDoc;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;However, before I create an event handler to run the script, if I save the script and restart the server which is connected to the project, the script runs twice. Basically, after a server restart, I have 2 new NEWDOCs in root (using nuxeoctl restart). Is this expected behaviour? I expected the script only to run once, and only each time an appropriately configured Event Handler ran. Here are the console.logs:&lt;/P&gt;
&lt;P&gt;2020-08-17T15:11:17,186 INFO  [http-nio-0.0.0.0-8080-exec-5] [org.nuxeo.runtime.reload.ReloadComponent] After start/resume component manager
2020-08-17T15:11:17,186 INFO  [http-nio-0.0.0.0-8080-exec-5] [org.nuxeo.runtime.reload.ReloadComponent] Start running deployment preprocessor
&lt;STRONG&gt;2020-08-17T15:11:17,319 WARN  [Nuxeo-Work-default-3:1148014024172349.1676155507] [org.nuxeo.automation.scripting.helper.Console] [LOG] Creating NEWDOC&lt;/STRONG&gt;
&lt;STRONG&gt;2020-08-17T15:11:17,344 WARN  [Nuxeo-Work-default-3:1148014024172349.1676155507] [org.nuxeo.automation.scripting.helper.Console] [LOG] Creating NEWDOC&lt;/STRONG&gt;
2020-08-17T15:11:18,511 INFO  [http-nio-0.0.0.0-8080-exec-5] [org.nuxeo.runtime.reload.ReloadComponent] Deployment preprocessing done
2020-08-17T15:11:18,511 INFO  [http-nio-0.0.0.0-8080-exec-5] [org.nuxeo.runtime.reload.ReloadComponent] Before reload runtime properties
2020-08-17T15:11:18,512 INFO  [http-nio-0.0.0.0-8080-exec-5] [org.nuxeo.runtime.reload.ReloadComponent] After reload runtime properties&lt;/P&gt;
&lt;P&gt;Regards,
Mark&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 15:33:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/script-running-at-server-startup/m-p/324753#M11754</guid>
      <dc:creator>Mark_Lumsden</dc:creator>
      <dc:date>2020-08-17T15:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Script running at Server startup</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/script-running-at-server-startup/m-p/324754#M11755</link>
      <description>&lt;P&gt;Can you more details about your event handler?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 13:32:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/script-running-at-server-startup/m-p/324754#M11755</guid>
      <dc:creator>Gregory_Carlin</dc:creator>
      <dc:date>2020-08-19T13:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Script running at Server startup</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/script-running-at-server-startup/m-p/324755#M11756</link>
      <description>&lt;P&gt;Hi Gregory, I created a more specific event handler and I resolved the problem. Thanks Mark&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 13:50:44 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/script-running-at-server-startup/m-p/324755#M11756</guid>
      <dc:creator>Mark_Lumsden</dc:creator>
      <dc:date>2020-08-21T13:50:44Z</dc:date>
    </item>
  </channel>
</rss>

