Python script as a systemd service

Hi Kevin,

Thank you for your reply! Not really, simple ‘else’ output. Here how my ‘while’ loop looks like:

timelas = 0

while True:

    timecur = os.path.getmtime(FILE)

    if timecur != timelas:

        for i in tail(FILE, 5):

            if INPUT.lower() in i.lower():
               
                subprocess.run(["echo", "new", "item"],)
                print("Check it 1")
          

            elif INPUT2.lower() in i.lower():

                subprocess.run(["echo", "new", "item2"],)
                print("Check it 2")
                
    else:
        print("Nothing new")

    timelas = timecur

    time.sleep(5)

The output:

INFO:__main__:Nothing new
INFO:__main__:Nothing new
INFO:__main__:Nothing new
INFO:__main__:Nothing new
INFO:__main__:Nothing new

The problem is that when there is some change in the file, the script does not seem to notice it and still outputs “INFO:main:Nothing new” to the log file.