rednspirited Posted July 16, 2019 Share Posted July 16, 2019 i have been searching the site for info but after hours of reading i decided to make this post. i have tried different ways but cant seem to make my cron files to work. i am only posting the minute file cause its the shortest and the code line is pretty much the same for each. any help i will be greatful for . thank you require_once(dirname(__FILE__) . "/../mysqli.php"); $cron_code = '* * * * * curl public_html/cron_minute.php?code=672bb9f5a0b168da99fbbf74980175ecd'; if ($argc == 2) { if ($argv[1] != $cron_code) { exit; } } else if (!isset($_GET['code']) || $_GET['code'] !== $cron_code) { exit; } mysqli_query("UPDATE users SET hospital=hospital-1 WHERE hospital>0", $c); Quote Link to comment Share on other sites More sharing options...
Crow Posted July 16, 2019 Share Posted July 16, 2019 No clue just here to stalk Quote Link to comment Share on other sites More sharing options...
AdamHull Posted July 17, 2019 Share Posted July 17, 2019 * * * * * curl public_html/cron_minute.php?code=672bb9f5a0b168da99fbbf74980175ecd This needs adding to your crontab you may have to add other file directories to the beging but there should be documentation in your crontab for this *Edit how ever you formatted that code has broken the code section and won't let me post it as code Quote Link to comment Share on other sites More sharing options...
rednspirited Posted July 17, 2019 Author Share Posted July 17, 2019 thanks i will try that and see what happens still didnt work is there somethingelse i should add? Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted July 17, 2019 Share Posted July 17, 2019 You've passed a cron command to a variable that shouldn't be there. Change your $cron_code var to hold, funnily enough, your cron's code (an override token that allows it to run). $cron_code = '672bb9f5a0b168da99fbbf74980175ecd'; You may also wish to generate a new cron token as that one is now public - note that, if you do, you will need to update the cron commands with the new token too 1 Quote Link to comment Share on other sites More sharing options...
rednspirited Posted July 17, 2019 Author Share Posted July 17, 2019 if my dataase is named battlefo_battlefo************* and my line reads like this php /home/battlefo/public_html/crons/cron_fivemins.php in my cornsjob Should it read battlefo_battlefo************ in the code line? Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted July 17, 2019 Share Posted July 17, 2019 You haven't passed the cron token to your command either. So, the top of your cron file (using the snippet you posted as reference) require_once dirname(__DIR__).'/mysqli.php'; $cron_code = '672bb9f5a0b168da99fbbf74980175ecd'; if ($argc == 2) { if ($argv[1] != $cron_code) { exit; } } else if (!isset($_GET['code']) || $_GET['code'] !== $cron_code) { exit; } And your command should be php /home/battlefo/public_html/crons/cron_fivemins.php code=672bb9f5a0b168da99fbbf74980175ecd Quote Link to comment Share on other sites More sharing options...
rednspirited Posted July 17, 2019 Author Share Posted July 17, 2019 1 hour ago, Magictallguy said: You haven't passed the cron token to your command either. So, the top of your cron file (using the snippet you posted as reference) require_once dirname(__DIR__).'/mysqli.php'; $cron_code = '672bb9f5a0b168da99fbbf74980175ecd'; if ($argc == 2) { if ($argv[1] != $cron_code) { exit; } } else if (!isset($_GET['code']) || $_GET['code'] !== $cron_code) { exit; } require_once dirname(__DIR__).'/mysqli.php'; $cron_code = '672bb9f5a0b168da99fbbf74980175ecd'; if ($argc == 2) { if ($argv[1] != $cron_code) { exit; } } else if (!isset($_GET['code']) || $_GET['code'] !== $cron_code) { exit; } And your command should be php /home/battlefo/public_html/crons/cron_fivemins.php code=672bb9f5a0b168da99fbbf74980175ecd php /home/battlefo/public_html/crons/cron_fivemins.php code=672bb9f5a0b168da99fbbf74980175ecd That's how it reads but they dont work Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted July 18, 2019 Share Posted July 18, 2019 Alright, let's try a slightly different method. Replace if ($argc == 2) { if ($argv[1] != $cron_code) { exit; } } else if (!isset($_GET['code']) || $_GET['code'] !== $cron_code) { exit; } with if (isset($argv)) { $args = parse_str($argv[1], $param); $_GET['code'] = $param['code']; } if(!array_key_exists('code', $_GET) or $_GET['code'] != $cron_code) { exit; } 1 Quote Link to comment Share on other sites More sharing options...
rednspirited Posted July 18, 2019 Author Share Posted July 18, 2019 Got it up and running thank you so much for the help I couldn't have figured it out with out your help 1 Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted July 18, 2019 Share Posted July 18, 2019 Happy to help, glad to hear you're up and running ^.^ Quote Link to comment Share on other sites More sharing options...
rednspirited Posted July 18, 2019 Author Share Posted July 18, 2019 Now on to the next ? thanks 1 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.