Проблема такая, при попытке выполнить скрипт выдает ошибку "Syntax error: "done" unexpected (expecting "fi")"
Хотя код вроде бы написал верно, в чем косяк ?
Проверял на онлайн редакторах они вроде бы не ругались....
#!/bin/bash
port_launcher=""
port_server=""
path_launcher="/home/mcm/HML/"
path_server="/home/mcm/test_TMS/"
var1=0
while [ $var1 -lt 5 ];
do
statusL=$(lsof -i :$port_launcher | grep -v 'grep' | head -n 1 | awk '{print $2}')
statusS=$(lsof -i :$port_server | grep -v 'grep' | head -n 1 | awk '{print $2}')
if [ "$statusL" = "" ] || [ "$statusS" = "" ];
then
if [ "$statusL" = "" ];
then
echo "|L| Start..."
date=$(date +%d.%m.%Y——%H:%M)
echo -e "\n[$date] |L| —— Proccess with port $port_launcher not found. Start..." >> /home/mcm/CMT/logs/LLogs.txt
cd $path_launcher; screen -d -m -S laun sh start.sh;
sleep 90
else
echo "|L| Is Running"
fi
if [ "$statusS" = "" ];
then
echo "|S| |TMS| Start..."
date=$(date +%d.%m.%Y——%H:%M)
echo -e "\n[$date] |S| |TMS| —— Proccess with port $port_server not found. Start..." >> /home/mcm/CMT/logs/SLogs.txt
cd $path_server; screen -d -m -S serv sh startp.sh;
var1=$( $var1 + 1 )
sleep 180
else
echo "|S| |TMS| Is Running..."
fi
else
echo "|L| Is Running..."
echo "|S| Is Running..."
break
fi
done