Cron job to test file time and send email?
My home network uploads a file with the date and time, which happens every five minutes. I wish to create a cron job which checks this file and sends me an email if the file is not updating. This would be an indication that my home network has lost internet connectivity.
I have been using cPanel for years, and create my own content. Just haven't used cron jobs at all.
Thanks for any assistance.
-
Hello @ATom1, You can read about how to setup cron jobs in cPanel at: Cron Jobs - Version 70 Documentation - cPanel Documentation As far as how to develop the script itself, StackOverflow is likely your best resource for development-related questions. Here's an example of a discussion there: Bash: Check if file was modified since used in script Thank you. 0 -
I have created a cron job as follows: /usr/bin/php -q /home2/myusrname/public_html/CheckHome.php >/dev/null
Here is the CheckHome.php file contents:5) { mail("1234567890@txt.att.net","Alert",$msg); } ?>
I tested the php script independently, so I know it works. However, I am not getting a text when the file is not being updated. The file is normally updated once per minute.0 -
It is working now; seems like it took a while for the cron job to commence. 0 -
It is working now; seems like it took a while for the cron job to commence.
Hello, I'm glad to see it's working well. I've marked this thread as solved. Thanks!0
Please sign in to leave a comment.
Comments
4 comments