feat(cli): 增加服务分组方便批量启停服务

服务可以分在多个分组里
This commit is contained in:
2024-02-04 18:27:51 +08:00
parent b8607dbdc4
commit d155779952
8 changed files with 127 additions and 38 deletions

View File

@@ -0,0 +1,5 @@
#!/bin/bash
<#list services as service>
${currentPath}/deploy-${service}.sh
</#list>

View File

@@ -0,0 +1,5 @@
#!/bin/bash
<#list services as service>
${currentPath}/stop-${service}.sh
</#list>

View File

@@ -16,7 +16,7 @@ security_darkcode='${runtime.security.darkcode}'
<#list hosts as host>
host=${host.ip}
echo "${info.name} ${host.ip} ${host.hostname} $datetime"
ssh $host 'bash -s' < stop.sh ${runtime.jarPath}/${info.name}.jar
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'`

View File

@@ -13,5 +13,5 @@ for host in <#noparse>${hosts[@]}</#noparse>
do
hostname=`ssh $host 'echo $HOSTNAME'`
echo "$host $hostname"
ssh $host "cat ${runtime.logPath}/${info.name}.log" > logs/${info.name}/$hostname.log
ssh $host "cat ${runtime.logPath}/${info.name}.log" > ${currentPath}/logs/${info.name}/$hostname.log
done

View File

@@ -10,5 +10,5 @@ for host in <#noparse>${hosts[@]}</#noparse>
do
hostname=`ssh $host 'echo $HOSTNAME'`
echo "$host $hostname"
ssh $host 'bash -s' < stop.sh ${runtime.jarPath}/${info.name}.jar
ssh $host 'bash -s' < ${currentPath}/stop.sh ${runtime.jarPath}/${info.name}.jar
done