1
#!/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。之后,它不会读取第二个文件,它只会执行脚本结尾的最后一个 echo。

你能建议为什么吗?

4

1 回答 1

1
value=$(</var/www/symmetric-ds-3.1.6/bin/my_mon.txt)
if [ "$LINE" == "false" ]; then
echo"Inside loop"
fi

这对我有用。我猜罪魁祸首是猫

于 2013-02-14T04:53:55.157 回答