Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5122

Advanced users • Re: Crontab to check file and run command?

$
0
0
Hi all,

I'm after some help here!

I need to be able to monitor a given file at regular intervals, and if a given value is present, to run a command (basically I need to monitor a file 'output.txt' and if the value is present, run a command to trigger a pager message - I know the command for that!)

I'm assuming I could use a cron job to do this, but i'm struggling to work out how to do it.

Any help would be appreciated!

Thanks,

J

You may find the help you are seeking in this user-contributed Resource -

Cron – A Beginner's Guide - viewtopic.php?t=347524

That'll tell you how to schedule and run a task. It won't solve the OP's question. And before anyone asks it won't ever do that as it's not something cron can do.

OP's question needs a shell, python, or other language script to open the file and check its contents which is then called periodically from cron.

Statistics: Posted by thagrol — Fri Dec 20, 2024 5:20 pm



Viewing all articles
Browse latest Browse all 5122

Trending Articles