#!/bin/sh
#filename=`find /log -name patch_log*`
#if [[ $filename = "" ]];then
# sleep 1
#fi
while [[ $filename = "" ]];do
sleep 0.01
filename=`find /log -name patch_log*`
done
read_line()
{
read
while [ $? -eq 0 ]
do
#echo $REPLY
if [[ "$REPLY" =~ "Successfullydddddddddddd" ]]
then
echo "found"
for pid in `ps aux | grep tail | grep -v grep | awk '{print $2}'`
do
kill -9 $pid
done
fi
# grep -q "Successfully" $REPLY && echo "find" || echo "not found"
read
done
}
tail -f "$filename" | read_line
#!/bin/sh
while [[ $filename = "" ]];do sleep 0.01;filename=`find /log -name patch_log*`;done; read_line() { read; while [ $? -eq 0 ]; do if [[ $REPLY =~ "start" ]]; then echo "found";for pid in `ps aux | grep tail | grep -v grep | awk '{print $2}'`; do kill -9 $pid; done fi; read; done;};tail -f $filename | read_line
阅读(1039) | 评论(0) | 转发(0) |