首页 > 解决方案 > nohup script stopped after some time

问题描述

I have a monitoring script running on my server which looks like

    #!/bin/sh
    tail -F /data/logs.txt | grep -E --line-buffered -io 'keyword1|keyword2' | while read -r line ; do

     case "$line" in
           "keyword1")
        echo "hi"
        ;;
     "keyword2")
         echo "hi1"
       ;;
      *)
     esac
    done

i have used -F in tail because if the new log file created it should follow the new file

I have ran that script in nohup to run indefinetly like below

nohup ./script.sh &

But the script getting stopped after a period of time

can someone help why it's happening ?

Thanks,

标签: linuxshelltailnohup

解决方案


推荐阅读