I've a php script which runs from webservice and insert to DB.
crontab -e
......other cron tasks above....... ... .. .. # Run test script.php at 1610 10 16 * * * /usr/bin/wget -q -O /home/username/my_cronjobs/logs/cron_adhoc http://localhost/project/script.php
Apparently, at 16:10, this script is run twice! 16:10:01 and 16:25:02
Is it something wrong and gotta do with using wget?? Or did i set the schedule on cron job wrongly?
When i run http://localhost/project/script.php from browser, it will only run once..
Any idea regarding this problem ?
I've tested, there are no other users running the same job... I suspect the way wget works.
As my script needs at least 20mins to complete without sending back a response (it is pulling alot of data from webservicces and save to db) .. suspect there's a time out or retry of wget by default causing this problem.
The wget command is a command line utility for downloading files from the remote servers. It's also used to triggers server side scripts using the cron jobs.
The wget docs give a default read-timeout of 900 seconds, or 15 minutes.
if, at any point in the download, no data is received for more than the specified number of seconds, reading fails and the download is restarted
This is why you were seeing the file called again 15 minutes later. You can specify a longer read-timeout by adding the parameter and an appropriate number of seconds:
--read-timeout=1800
i think i solve my own question.
My php takes some time to load, i guess wget retries or time out after some default specified time.
I solved it by using /usr/bin/php
Whose user's crontab is this?
Check if there is another user for which you set up cron job at different time and forgot about it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With