Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
-  
+
        http://www.apache.org/licenses/LICENSE-2.0
-  
+
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
        <fileSets>
                <fileSet>
-                       <directory>src/main/bin</directory>
+                       <directory>src/main/scripts</directory>
                        <outputDirectory>bin</outputDirectory>
                </fileSet>
                <fileSet>
 
 
                SdncUebCallback cb = new SdncUebCallback(client, config);
 
+
                LOG.info("Scanning for local distribution artifacts before starting client");
                cb.deployDownloadedFiles(null, null, null);
 
 
                LOG.info("Initialized ASDC distribution client - results = {}", result.getDistributionMessageResult());
 
-               if (result.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS) {
-                       LOG.info("Starting client...");
-                       IDistributionClientResult start = client.start();
-                       LOG.info("Client startup result = {}", start.getDistributionMessageResult());
+               long startTm = System.currentTimeMillis();
+               int sleepTm = config.getPollingInterval() * 1000;
+               long maxWaitTm = config.getClientStartupTimeout() * 1000;
+
+               boolean keepWaiting = true;
+
+               while (keepWaiting) {
+                       if (result.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS) {
+                               LOG.info("Starting client...");
+                               try {
+                                       IDistributionClientResult start = client.start();
+                                       LOG.info("Client startup result = {}", start.getDistributionMessageResult());
+                                       keepWaiting = false;
+                               } catch(Exception e) {
+                                       LOG.info("Client startup failure", e);
+                               }
+
+                               if (System.currentTimeMillis() - startTm < maxWaitTm) {
+                                       keepWaiting = false;
+                               } else {
+
+                                       try {
+                                               Thread.sleep(sleepTm);
+                                       } catch (InterruptedException e) {
+                                               // Ignore
+                                       }
+                               }
+                       }
+
                }
 
 
+
        }
 
 }
 
        private String password = null;
        private int pollingInterval = 30;
        private int pollingTimeout = 15;
+       private int clientStartupTimeout = 900;
        private List<String> relevantArtifactTypes = null;
        private String user = null;
 
                        }
                }
 
+               curval = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.client-startup-timeout");
+               if ((curval != null) && (curval.length() > 0)) {
+                       try {
+                               clientStartupTimeout = Integer.parseInt(curval);
+                       } catch (Exception e) {
+                               LOG.warn("Illegal value for org.onap.ccsdk.sli.northbound.uebclient.polling-timeout ({}) ", curval, e);
+                       }
+               }
                curval = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.relevant-artifact-types");
                if ((curval != null) && (curval.length() > 0)) {
                        String[] artifactTypes = curval.split(",");
                return relevantArtifactTypes;
        }
 
+       public int getClientStartupTimeout() {
+               return clientStartupTimeout;
+       }
+
        @Override
        public String getUser() {
                return user;
 
 org.onap.ccsdk.sli.northbound.uebclient.spool.archive=src/test/resources/archive
 org.onap.ccsdk.sli.northbound.uebclient.polling-interval=30
 org.onap.ccsdk.sli.northbound.uebclient.polling-timeout=15
+org.onap.ccsdk.sli.northbound.uebclient.client-startup-timeout=60
 org.onap.ccsdk.sli.northbound.uebclient.relevant-artifact-types=YANG_XML,VF_LICENSE,TOSCA_TEMPLATE,TOSCA_CSAR,UCPE_LAYER_2_CONFIGURATION
 org.onap.ccsdk.sli.northbound.uebclient.activate-server-tls-auth=false
 org.onap.ccsdk.sli.northbound.uebclient.keystore-path=