#!/bin/bash
# Reading Manthan Status
echo "Manthan cat started"
cat /var/www/symmetric-ds-3.1.6/bin/my_mon.txt | while read LINE
do
echo "Inside my loop"
echo "$LINE"
if [ "$LINE" == "false" ]; then
echo "startedif_my"
sudo lsof -n -i:8082 | grep LISTEN | awk '{ print $2 }' | uniq |sudo xargs kill -9;
sleep 30;
sudo sh /var/www/symmetric-ds-3.1.6/bin/sym --port 8082 --server;
break
fi
done
#Reading Panel Status
echo "Panel cat started"
cat /var/www/symmetric-ds-3.1.6/bin/panel_mon.txt | while read LINE
do
echo "Inside panel loop"
echo "$LINE"
if [ "$LINE" == "false" ]; then
sudo lsof -n -i:8082 | grep LISTEN | awk '{ print $2 }' | uniq |sudo xargs kill -9;
sleep 30;
sudo sh /var/www/symmetric-ds-3.1.6/bin/sym --port 8082 --server;
break
fi
done
echo "end of script"
当我运行上面的脚本时,脚本会读取第一个文件并回显$ Line。之后,它不会读取第二个文件,它只会持续作为脚本结束的回声。
你能告诉我为什么吗?
答案 0 :(得分:1)
value=$(</var/www/symmetric-ds-3.1.6/bin/my_mon.txt)
if [ "$LINE" == "false" ]; then
echo"Inside loop"
fi
这对我有用。我猜是罪魁祸首