Kurewe

External Time Until Restart Clock/Timer

15 posts in this topic

I have added the necessary changes/files and updates. The sample pulls the time from the database, but the server doesn't seem to be updating the time. i double checked that the overwrite was there, correct folder and config entry. is there an event that has to happen to trigger a database update or is it on timed interval?  Thanks.

Some testing I have done... I have a statusbar function that displays a time to restart. So, i added the database write to it,

//Start lines added for Time Until Restart database update

_time = time;
_hours = (ExAd_SB_Timer - 1) - floor (_time / 3600);
_minutes = 59 - floor ((_time % 3600) / 60);
_restartTimerID = 1;
_timeTilRestart = _hours * 60 + _minutes;
format["updateTimeUntilRestart:%1:%2",_timeTilRestart,_restartTimerID] call ExileServer_system_database_query_fireAndForget;

//End lines added for Time Until Restart database update

My concern is, being this a client side script, 1st it will only fire while users are online, 2nd will fire over and over for each and every user online.. Still cannot figure out why the rcon function isn't firing off.

Edited by geekm0nkey

Share this post


Link to post
Share on other sites

Ok, solved my issue by moving the code to its own script inside of init.sqf.. for whatever reason the rcon overwrite would not write to the database.. so here was what i did to fix it.

open/create init.sqf and add/insert the following at the top.

if (isServer) then {
	[] execVM "addons\timetorestartdb.sqf"; // send time to restart to DB
};

create a file called timetorestartdb.sqf and put it in an addons folder or whatever folder you like, just update the above change to match.

if (!isServer) exitWith {};

while {true} do
{
	//Start lines added for Time Until Restart database update
	_restartTime = 180; // change to your restart time in minutes.
	_uptime = call ExileServer_util_time_uptime;
	_timeTilRestart = _restartTime - _uptime;
	_restartTimerID = 1;
	format["updateTimeUntilRestart:%1:%2",_timeTilRestart,_restartTimerID] call ExileServer_system_database_query_fireAndForget;
	uisleep 60;
	//End lines added for Time Until Restart database update
};

Hope this helps anyone else who happens to have this issue.

Share this post


Link to post
Share on other sites
Advertisement

Hi guys I need some help please, what would I need to change to get this to run on php7.2, at the moment the highest it will run on is php7.0, as soon as I update to php7.2 my webserver error log gets spammed with the below:

Spoiler

[13-Mar-2018 12:27:25 UTC] PHP Warning:  mysqli::__construct(): (HY000/2002): Connection timed out in /home/wilderne/public_html/timer.php on line 16
[13-Mar-2018 12:29:22 UTC] PHP Warning:  mysqli::__construct(): (HY000/2002): Connection timed out in /home/wilderne/public_html/timer.php on line 16
[13-Mar-2018 12:30:31 UTC] PHP Warning:  mysqli::__construct(): (HY000/2002): Connection timed out in /home/wilderne/public_html/timer.php on line 16
[20-Mar-2018 09:30:13 UTC] PHP Fatal error:  Uncaught Error: Class 'mysqli' not found in /home/wilderne/public_html/timer.php:16
Stack trace:
#0 {main}
  thrown in /home/wilderne/public_html/timer.php on line 16
[20-Mar-2018 09:30:21 UTC] PHP Fatal error:  Uncaught Error: Class 'mysqli' not found in /home/wilderne/public_html/timer.php:16
Stack trace:
#0 {main}
  thrown in /home/wilderne/public_html/timer.php on line 16
[20-Mar-2018 09:31:09 UTC] PHP Fatal error:  Uncaught Error: Class 'mysqli' not found in /home/wilderne/public_html/timer.php:16
Stack trace:
#0 {main}
  thrown in /home/wilderne/public_html/timer.php on line 16
[20-Mar-2018 09:31:11 UTC] PHP Fatal error:  Uncaught Error: Class 'mysqli' not found in /home/wilderne/public_html/timer.php:16
Stack trace:
#0 {main}
  thrown in /home/wilderne/public_html/timer.php on line 16
[20-Mar-2018 09:32:17 UTC] PHP Fatal error:  Uncaught Error: Class 'mysqli' not found in /home/wilderne/public_html/timer.php:16
Stack trace:
#0 {main}
  thrown in /home/wilderne/public_html/timer.php on line 16
[20-Mar-2018 09:32:21 UTC] PHP Fatal error:  Uncaught Error: Class 'mysqli' not found in /home/wilderne/public_html/timer.php:16
Stack trace:
#0 {main}
  thrown in /home/wilderne/public_html/timer.php on line 16
[20-Mar-2018 09:32:23 UTC] PHP Fatal error:  Uncaught Error: Class 'mysqli' not found in /home/wilderne/public_html/timer.php:16
Stack trace:
#0 {main}
  thrown in /home/wilderne/public_html/timer.php on line 16
[20-Mar-2018 09:32:24 UTC] PHP Fatal error:  Uncaught Error: Class 'mysqli' not found in /home/wilderne/public_html/timer.php:16
Stack trace:
#0 {main}
  thrown in /home/wilderne/public_html/timer.php on line 16
[20-Mar-2018 09:32:26 UTC] PHP Fatal error:  Uncaught Error: Class 'mysqli' not found in /home/wilderne/public_html/timer.php:16
Stack trace:
#0 {main}
  thrown in /home/wilderne/public_html/timer.php on line 16
[20-Mar-2018 09:32:27 UTC] PHP Fatal error:  Uncaught Error: Class 'mysqli' not found in /home/wilderne/public_html/timer.php:16
Stack trace:
#0 {main}
  thrown in /home/wilderne/public_html/timer.php on line 16
[20-Mar-2018 09:32:28 UTC] PHP Fatal error:  Uncaught Error: Class 'mysqli' not found in /home/wilderne/public_html/timer.php:16
Stack trace:
#0 {main}
  thrown in /home/wilderne/public_html/timer.php on line 16
[20-Mar-2018 09:32:30 UTC] PHP Fatal error:  Uncaught Error: Class 'mysqli' not found in /home/wilderne/public_html/timer.php:16
Stack trace:
#0 {main}
  thrown in /home/wilderne/public_html/timer.php on line 16
[20-Mar-2018 09:32:31 UTC] PHP Fatal error:  Uncaught Error: Class 'mysqli' not found in /home/wilderne/public_html/timer.php:16
Stack trace:
#0 {main}
  thrown in /home/wilderne/public_html/timer.php on line 16
[20-Mar-2018 09:32:32 UTC] PHP Fatal error:  Uncaught Error: Class 'mysqli' not found in /home/wilderne/public_html/timer.php:16
Stack trace:
#0 {main}
  thrown in /home/wilderne/public_html/timer.php on line 16

So for the moment I've rolled back to php7.0 to keep it running as it proves very useful for our players on the other side of the pond (Good old USA)

Would be really nice to get this running on php7.2 as some of the newer application won't support less than php7.0 but we all know it's only going to move one way at some point in the future.

Many thanks

Share this post


Link to post
Share on other sites

Ok as you can see I managed to connect with the database as when I change the time in the db it will automatically update on my site
https://coyote-exile.com/timer.php

But for some reason it's not counting down the time... 

I'm using IPB 4.2 do they support GD, can that be a problem?

 

*UPDATE: Just checked with my hosting provider and GD Support is enabled, I've followed the instruction correctly as you can see the timer on my website and when I update the time in the DB it will automatically change on my site (which means it's been connected correctly).

THIS SCRIPT IS NOT WORKING ON IPS!

Edited by Batu786

Share this post


Link to post
Share on other sites
On 5/10/2018 at 11:38 AM, Batu786 said:

*UPDATE: Just checked with my hosting provider and GD Support is enabled, I've followed the instruction correctly as you can see the timer on my website and when I update the time in the DB it will automatically change on my site (which means it's been connected correctly).

THIS SCRIPT IS NOT WORKING ON IPS!

Sorry, I don't visit the site very much these days. If your DB is not automatically updating, it sounds like you missed or messed up step 2 and/or 3 in the instructions. Double check those two steps. Those are the two steps that specifically relate to updating the DB with the restart time.

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.