I have a PHP script that goes through all products in the database and looks at session files to see which products are in users' baskets. Then it releases stock which is allocated to baskets but the sessions for those baskets have expired. Simple enough.
For every product in the loop it prints out the product ID.
If I run the script from command line:
./release.php
It runs through all the products (~2500). However, if the script is run by crontab, it goes up to somewhere between 150 and 300 products; then it stops without any errors.
crontab -l # m h dom mon dow command */3 * * * * /var/www/vhosts/example.com/release.php &> $HOME/release.log
There's nothing useful in /var/log/cron.log
, either:
Jun 7 10:00:01 xxxxxxx /USR/SBIN/CRON[15751]: (root) CMD (/var/www/vhosts/example.com/release.php &> $HOME/log)
Are you sure it's stopping? You execute the script every 3 minutes, and on each call you "reset" the logfile. (>file
instead of >>file
)
Do you use some kind of locking mechanism to prevent the script to start if it is already running?
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