#!/bin/bash

datetime=`date +%Y%m%d%H%M%S`
<#list hosts as host>
host=${host.ip}
echo "${info.name} ${host.ip} ${host.hostname} $datetime"
ssh $host 'bash -s' < ${currentPath}/stop.sh ${runtime.jarPath}/${info.name}.jar
<#if selectedHosts?seq_contains(host.ip)>
<#-- 获取主机域名 -->
hostname=`ssh $host 'hostname'`
<#-- 获取主机域名全名 -->
hostname_full=`ssh $host 'hostname -f'`
<#-- 获取当前时间 -->
start_time=`date +%Y%m%d%H%M%S`
ssh $host "mkdir -p ${runtime.jarPath};curl ${runtime.downloadUrl}/${info.sourceJar} -o ${runtime.jarPath}/${info.name}.jar"
ssh $host "export JASYPT_ENCRYPTOR_PASSWORD='r#(R,P\"Dp^A47>WSn:Wn].gs/+\"v:q_Q*An~zF*g-@j@jtSTv5H/,S-3:R?r9R}.';nohup ${runtime.jdkPath[info.jdk!(runtime.defaultJdk)]}/bin/java <#list environments?keys as key>-D${key}=${environments[key]?string} </#list>-jar ${runtime.jarPath}/${info.name}.jar <#noparse>--deploy.datetime=${datetime} --deploy.ip=${host} --deploy.hostname=${hostname} --deploy.hostname-full=${hostname_full} --deploy.start-time=${start_time}</#noparse> --hudi-service.signature=${runtime.signature} --logging.parent=${runtime.logPath} --spring.cloud.zookeeper.connect-string=${runtime.zkUrl} --spring.security.meta.authority='${runtime.security.authority}' --spring.security.meta.username='${runtime.security.username}' --spring.security.meta.darkcode='${runtime.security.darkcode}' --yarn-cluster.sync-clusters=${runtime.yarn.syncClusters} --yarn-cluster.compaction-clusters=${runtime.yarn.compactionClusters} <#list arguments?keys as key>--${key}='${arguments[key]?string}' </#list>> /dev/null 2>&1 &"
</#if>
echo ''
</#list>
