我在这里做错了什么。我对 bash 不太有经验,但正在尝试。总之,我尝试从一个盒子(管理)进行 ssh,并在该目录中找到名为“Debug-EmapiTagwireConnector-Wire-2022-05-24”*”的文件。该文件位于 procIP=10.1 内。 2.3 。该脚本设法 ssh 到该位置,但我似乎无法 grep 或找到该脚本,我知道该文件存在于 ~/TTT/system/taxm1/Debug-EmapiTagwireConnector-Wire-2022-05-24 。 --15.51.43.log 但我似乎无法 grep 它我做错了什么?
#!/bin/bash
set -x
dateToday=$(date -d today +%Y'-'%m'-'%d)
function validateLog()
{
tax=~/HealthChecks/cfg/taxm.cfg
if [ -e "$tax" ];
then
for i in `cat $tax`
do
myIP=`$getServerDetail $i`
DebugLog=$(find ./ -type f -name "Debug-EmapiTagwireConnector-Wire-2022-05-24*")
ssh ${USER}@$myIP "cd ~/TTT/system/$i; if [ -f ${DebugLog} ]; then echo "${DebugLog} found." ; else echo "Failed to locate file."; exit 1; fi" ||
{
$logWriter "Connection to ${i} failed. Exiting script." 1
exit 1
}
$logWriter "Validation completed." 0
done
exit 0
else
$logWriter "CFG is missing." 1
exit 1
fi
}
validateLog