CronJob
Re: CronJob
Yup! This is the most common issue admins face when trying to get BNT setup.FoxMuldr wrote:I am having trouble getting my game to respond to the cronjob that calls the scheduler to update. Anyone have any insights into this?
Two pieces of advice usually help the most. First, try accessing the scheduler in your browser. http://example.com/scheduler.php , and then enter the admin password. If it works, great! On to step two. If not, share the errors you get.
The rest I will quote from our fine docs/install manual in SVN today:
Contact your hosting provider, and determine which command-line web fetching program they make
available to you, and where it is located. This is to help set up a background task that will be called
every X minutes.
You can set this to any interval you want, but 5 or 6 minutes are good standard values.
This task needs to call the web page scheduler.php passing the admin password to it, eg by accessing:
http://localhost/blacknova/scheduler.ph ... h=password
On UNIX and Linux, you can achieve this by using cron to call lynx to access
the pages at specified times. Lynx is just one of many programs you can use to access the page. It
may not be available on your server, and you will need to substitute a different program. Please check
your hosting provider documentation to determine which program is available.
A sample crontab follows:
*/6 * * * * /usr/bin/lynx --dump http://localhost/blacknova/scheduler.ph ... h=password > /dev/null
A few alternatives:
*/6 * * * * /usr/bin/GET http://localhost/blacknova/scheduler.ph ... h=password > /dev/null
*/6 * * * * /usr/bin/wget "http://localhost/blacknova/scheduler.ph ... h=password" > /dev/null
Please note that your hosting provider may have these programs at a different location than /usr/bin, requiring
you to change the location to match their documentation.
You may need to alter the URL to point to your exact domain name
and path. You will also need to change the password to your admin password.
To specify how fast-paced you want the game to be, you will need to
edit the file config.php and select how many minutes you want between
different events, eg turns or port regeneration.
Re: CronJob
Thanks for sharing this soultions.
- TheMightyDude
- Site Admin
- Posts: 311
- Joined: Thu Apr 17, 2014 09:15 UTC
Re: CronJob
What command line do you have in the cron tab?coolmates wrote:i am getting a cannot open input file and no such file or directory errors in cron, yet the file works fine when accessed in a browser.
tried server path and direct url in cron but without success.
Try using the following in crontab:
Code: Select all
*/6 * * * * /usr/bin/lynx --dump http://www.cool-mates.com/bnt/scheduler.php?swordfish=ADMINPASS > /dev/null
The */6 means call that page every 6 mins.
Re: CronJob
Try dropping /dev/null from the cron line (it'll probably write a file to your home directory that you'll need to delete, so don't consider it fixed if it works)coolmates wrote:i am getting a cannot open input file and no such file or directory errors in cron, yet the file works fine when accessed in a browser.
tried server path and direct url in cron but without success.
Might have a permissions issue and not able to access /dev/null
Re: CronJob
Two error messages: Cannot open input file (Which input file?), and no such file or directory (Which file or directory).coolmates wrote:i am getting a cannot open input file and no such file or directory errors in cron, yet the file works fine when accessed in a browser.
tried server path and direct url in cron but without success.
COPY AND PASTE the COMPLETE error message, so its not an interpretation of a summary of multiple errors, so we can help you better.
My guess? Your host doesn't have the particular program (wget/lynx/links/etc) that you tried in your crontab. The error message should include the line you used in cron, so we can try to help.
Also useful? Which hosting company? What *distribution* of Linux are they running? If you don't mind sharing, what is the link to setup_info.php?
Help us, help you.
Re: CronJob
To help further, I've created a script that can help determine which tool you should use from cronjobs.
https://gist.github.com/anonymous/09c72cf93fe162d50f40
Sample result..
I will work to include this in the next version of setup_info.php for BNT.
https://gist.github.com/anonymous/09c72cf93fe162d50f40
Sample result..
Then you can put that into your cron, and you should have success.You can use any of the following in your crontab:
/usr/bin/curl
/usr/local/bin/wget
I will work to include this in the next version of setup_info.php for BNT.
Re: CronJob
To help us improve, can you share what the working solution was for your server?coolmates wrote:thanks everyone for your kindness. the grabber worked like a charm, and as a result, so is the cronjob.
Thanks!