Asked by David Atkin
at 2024-08-09 02:49:17
Point:400 Replies:12 POST_ID:828722USER_ID:11621
Topic:
PHP Scripting Language;Apache Web Server;Linux Programming
Hello experts,
I am having a problem on one of my CentOS Servers.
I have a php script that checks a mysql database, if a value = 1 then it sends an sms and email to the relevant person with some data. When running the script manually via a web browser or on the server by command it does exactly as it should, it sends the email, sends the sms and updates my DB correctly (changing a value to 0).
However when I try and run the same script from a crontab -e (logged in as root) it will loop my script. I am getting multiple emails and sms.
My Cron Job:
MAILTO="me@myemail.com"
53 20 * * * /usr/bin/php /var/www/html/website/system/crons/upcoming.php
The mailto just sends me an email confirming that it has run the Cron. I get multiple of these aswell.
I've tried running the cron as a wget and putting the url in but it does the same thing.
I've also tried running the script from the system crontab file and under different users.
I'm happy that my php script is fine as it runs manually perfectly.
Any suggestions?
I am having a problem on one of my CentOS Servers.
I have a php script that checks a mysql database, if a value = 1 then it sends an sms and email to the relevant person with some data. When running the script manually via a web browser or on the server by command it does exactly as it should, it sends the email, sends the sms and updates my DB correctly (changing a value to 0).
However when I try and run the same script from a crontab -e (logged in as root) it will loop my script. I am getting multiple emails and sms.
My Cron Job:
MAILTO="me@myemail.com"
53 20 * * * /usr/bin/php /var/www/html/website/system/crons/upcoming.php
The mailto just sends me an email confirming that it has run the Cron. I get multiple of these aswell.
I've tried running the cron as a wget and putting the url in but it does the same thing.
I've also tried running the script from the system crontab file and under different users.
I'm happy that my php script is fine as it runs manually perfectly.
Any suggestions?