Raised This Month: $51 Target: $400
 12% 

Daily Restart


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   General Purpose        Approver:   v3x (159)
watch
Senior Member
Join Date: Sep 2005
Old 02-21-2006 , 10:38   Daily Restart
Reply With Quote #1

Daily Restart

Description
- Automatically attempts to restart your server once a day only if its has no players on it

- Servers often don't get restarted unless they crash and often after a few days of uptime they can start to perform badly and people complain of lag

- Assuming you are using something to restart your server when its shutdown, like serverdoc it will work correctly (most gsp's will have scripts automatically restart servers when hlds crashes/shutdown anyway)

How to install:
- Find your plugins.ini in your config folder (addons/amxmodx/configs/plugins.ini) open it in notepad and type restart.amxx
- Click Get Plugin below and place the restart.amxx in your plugins folder (addons/amxmodx/plugins/)
Attached Files
File Type: sma Get Plugin or Get Source (dailyrestart.sma - 3412 views - 1.1 KB)
__________________
Code:
#include <amusing_small_signiture>

Last edited by watch; 08-15-2006 at 06:33.
watch is offline
diamond-optic
Veteran Member
Join Date: May 2005
Old 02-21-2006 , 12:26  
Reply With Quote #2

people who run 24/7 servers without a timelimit will appreciate this...

especially when they would run the server for days on end without a restart and wonder why everyone complained it was incredibly laggy
__________________
diamond-optic is offline
watch
Senior Member
Join Date: Sep 2005
Old 02-21-2006 , 12:48  
Reply With Quote #3

atm it hooks off mapchange so it wouldnt work if the timelimit is 0 im trying to think of a better way to do it
watch is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-21-2006 , 15:06  
Reply With Quote #4

I didn't know there's an event "30".

But anyways, you can try set_task on an extremely long time, even though it's not really a good idea. What you could also do is hook client_disconnect, check if the time is overdue, and if it is and there's no one else on the server, restart it.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
BACARRA
Senior Member
Join Date: Mar 2005
Old 02-21-2006 , 15:19  
Reply With Quote #5

is it possible for it to work say at midnight every X days?
BACARRA is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 02-21-2006 , 16:13  
Reply With Quote #6

Quote:
Originally Posted by BACARRA
is it possible for it to work say at midnight every X days?
Yes
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
watch
Senior Member
Join Date: Sep 2005
Old 02-21-2006 , 16:55  
Reply With Quote #7

Quote:
Originally Posted by BACARRA
is it possible for it to work say at midnight every X days?
How it works is saves the last restart date in the vault, when the function is called, which is currently done on mapchange it checks if the currentdate and the saved last restart date match, if so it carrys on with the changelevel.

If the dates don't match it checks if there are any players on the server excluding bots, if there are no players restart (saving the last restart date), else carry on with the changelevel. This will repeat each changelevel until it has an opportunity to restart.

Wouldnt you rather your server restarted when it doesn't have players on, rather than when it does have players on?

If you really really wanted to do it on midnight you could see if your provider will do a cron job as that would probably be more efficient or theres probably a task scheduler plugin for amxx floating about somewhere.

Quote:
Originally Posted by Hawk552
What you could also do is hook client_disconnect, check if the time is overdue, and if it is and there's no one else on the server, restart it.
Yea i thought about that although when the map changes everyone is disconnected and the function would be run x howevery many people were on the server, i wasnt sure if that could possibly cause problems?

Ill test it and If its not an issue ill update it to disconnect
__________________
Code:
#include <amusing_small_signiture>
watch is offline
badboyz
Member
Join Date: Dec 2005
Location: East Brunswick NJ
Old 02-21-2006 , 17:25  
Reply With Quote #8

Good job, going on my server because it laggs once in a while...
__________________

Warcraft3 FT -=oG=- Clan
69.248.82.68:27016

-=oG=- Normal Server ~Tryout~
69.248.82.68:27023
-=oG=- Clan Website
badboyz is offline
Send a message via AIM to badboyz Send a message via MSN to badboyz
BACARRA
Senior Member
Join Date: Mar 2005
Old 02-21-2006 , 18:09  
Reply With Quote #9

watch. the problem is my server is never empty so it wouldn't work if you say empty server.

suicide. if its not too much of a problem, can you make a version like that?
BACARRA is offline
watch
Senior Member
Join Date: Sep 2005
Old 02-21-2006 , 19:12  
Reply With Quote #10

You would be better off using a cron job if you can set one up or using this
__________________
Code:
#include <amusing_small_signiture>
watch is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:46.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode