0

I have been tried for few hours and nearly 1 day to try with this but I failed to make it
I want to run the cron file every 10 minutes and I searched for so many tutorials but I don't know why it is not working.
Anyone here who experienced in Webmin scheduled cron job can give me any suggestions?

webmin cron job setting

Sunny
  • 477
  • 2
  • 5
  • 15
  • What happens when you click "Run Now"? – Grzegorz Adam Kowalski Apr 28 '14 at 10:48
  • I don't think that *cron* support in webmin in inherently broken. My guess is that you have no other way to test your script (i.e., no `ssh` service in your current hosting) and you just wait 15 minutes, verify whatever output the script is expected to produce (you don't say) and find it isn't there (email, database row, whatever). You need to do proper debugging: verify each individual step (rather than everything at once) and make sure you're able to get error messages when they happen. – Álvaro González Apr 28 '14 at 10:59
  • Educated guess: script is inside `public_html`. Does it rely on web stuff like cookies, sessions, GET, POST...? – Álvaro González Apr 28 '14 at 11:02
  • The file run successfully when I click "run now" or "save and run" – Sunny Apr 28 '14 at 13:03

2 Answers2

0

Have you got PHP-CLI installed on your webmin server? If not, you can install it using:

sudo apt-get install php7.0-cli
sudo apt-get install php5-cli

Either of the commands will work, however it depends on the PHP version you are currently using.

Once installed it will allow you to run PHP command through the command line. Your CRON Job should look simlar to this:

php /var/www/example.com/public_html/crons.php

I haven't had time to test the code, however it should work.

MrEditor97
  • 80
  • 8
0

Another solution worked for me was adding complete URL of the file preceding by the 'GET' keyword instead of running it as a php script.

Example: GET 'https://www.example.com/crons.php'

Naser Nikzad
  • 713
  • 12
  • 27