Register for your free account! | Forgot your password?

You last visited: Today at 19:47

  • Please register to post and access all features, it's quick, easy and FREE!


Auto Restart

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2010
Posts: 89
Received Thanks: 19
Auto Restart

can someone give me a code to restart the server every 2 1/2 hours.



5supertao is offline  
Old 02/17/2010, 07:37   #2
 
elite*gold: 0
Join Date: Feb 2010
Posts: 80
Received Thanks: 29
Go to Program.cs and search for

PHP Code:
Database.LoadLottoItems(); 
Then add these under it
PHP Code:
                Program.WriteLine();
                
Program.RestartTimer = new System.Timers.Timer();
                
Program.RestartTimer.Interval = (120 60000);
                
Program.RestartTimer.Elapsed += new System.Timers.ElapsedEventHandler(Program.Restart);
                
Program.RestartTimer.Start();
                
Program.RestartTimer1 = new System.Timers.Timer();
                
Program.RestartTimer1.Interval = (10 60000);
                
Program.RestartTimer1.Elapsed += new System.Timers.ElapsedEventHandler(Program.Restart1);
                
Program.RestartTimer1.Start();
                
Program.WriteLine("Server restart timer ON"); 

Then add these voids

PHP Code:
        public static void Restart1(object sourceSystem.Timers.ElapsedEventArgs e)
        {
            
Program.WriteLine("Server will restart in 10 min");
            
Game.World.SendMsgToAll("Server""Server will restart in 10 minitues. Please log off to avoid data loses"20010);
          
        }
        public static 
void Restart(object sourceSystem.Timers.ElapsedEventArgs e)
        {

            
NewestCOServer.Main.AuthWorker.Listener.Close();
            
NewestCOServer.Main.GameWorker.Listener.Close();
            try
            {
                foreach (
Game.Character C in Game.World.H_Chars.Values)
                {
                    try
                    {
                        
C.MyClient.Disconnect();
                        
Console.WriteLine(C.Name " has logged off successfuly.");
                    }
                    catch { continue; }
                }
            }
            catch { }
            
Database.SaveKOs();
            
Console.WriteLine("KOs saved.");
            
Database.SaveEmpire();
            
Console.WriteLine("Empire saved.");
            
Features.Guilds.SaveGuilds();
            
Console.WriteLine("Guilds saved.");
            
Features.SkillsClass.Save();
            
Console.WriteLine("Skills saved.");
            
Console.WriteLine("Database disposed.");
            
Console.WriteLine("Write /exit or click X to close the window.");
            
System.Diagnostics.Process.Start("NewestCOServer.exe");
            
Environment.Exit(0);
        }
    }


That will restart your server every 2 hours.


xSynthesis is offline  
Old 04/08/2010, 00:35   #3
 
elite*gold: 0
Join Date: May 2006
Posts: 297
Received Thanks: 58
what is the defenition for : RestartTimer?
(in Database ore ProgramCs.?
pintser is offline  
Old 04/08/2010, 00:36   #4
 
elite*gold: 0
Join Date: Apr 2010
Posts: 273
Received Thanks: 50
doing it hard
Make a simple timer for it and a methode then your done


zTREME is offline  
Old 04/08/2010, 00:42   #5
 
elite*gold: 0
Join Date: May 2006
Posts: 297
Received Thanks: 58
u following my posts ...
pintser is offline  
Old 04/08/2010, 04:44   #6
 
elite*gold: 20
Join Date: May 2007
Posts: 1,121
Received Thanks: 330
Why make 2 Timers? Why not make just one, and then call the other void (or merge them into one large one)? D:

More efficient in my opinion...but then again...if a server needs to be restarted automatically...it's not so efficient to begin with. x.x
LetterX is offline  
Old 04/08/2010, 14:46   #7
 
elite*gold: 0
Join Date: Apr 2010
Posts: 273
Received Thanks: 50
Quote:
Originally Posted by LetterX View Post
Why make 2 Timers? Why not make just one, and then call the other void (or merge them into one large one)? D:

More efficient in my opinion...but then again...if a server needs to be restarted automatically...it's not so efficient to begin with. x.x
dats what i said.
Just make a simple timer and a methode ^^
zTREME is offline  
Old 04/09/2010, 03:32   #8
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 490
.. what source?
PeTe Ninja is offline  
Old 04/09/2010, 21:52   #9
 
elite*gold: 0
Join Date: Dec 2009
Posts: 52
Received Thanks: 1
@PeTe
5165

@Synthesis
I dont think thats 2 1/2 hours cause my server just retarted, I think it was 20-25 mins or so. what would i change the "120" to to make it 2.5 hours? >.>
Jăy1029 is offline  
Old 04/09/2010, 22:28   #10
 
elite*gold: 0
Join Date: Apr 2010
Posts: 273
Received Thanks: 50
Quote:
Originally Posted by Jăy1029 View Post
@PeTe
5165

@Synthesis
I dont think thats 2 1/2 hours cause my server just retarted, I think it was 20-25 mins or so. what would i change the "120" to to make it 2.5 hours? >.>
change 60000
zTREME is offline  
Old 04/12/2010, 18:21   #11
 
elite*gold: 0
Join Date: May 2006
Posts: 297
Received Thanks: 58
This aint working for my source..
bcs i dont have defenition of RestartTimer

but in most basic sources, there is a auto-restarter,
in program cs if i am right..

where to put this 1 exactly, ttried to run it sometimes, but no luck
pintser is offline  
Old 04/12/2010, 18:38   #12
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,338
Received Thanks: 489
public static System.Timers.Timer RestartTimer = new System.Timers.Timer();


~Yuki~ is offline  
Reply



« Lua(?) | [Question] Editing the Monster.dat file [5165] »

Similar Threads
[Request] Guilds, Friends, Marriage, Auto Restart
07/02/2009 - CO2 PServer - Discussions / Questions - 8 Replies
Hi everyone! I'd like some help fixing my code for these sections. I use PowerSource. I would appreciate any code given, and any explanations on how to figure it out would be great. Guilds - The name 'DataBase' does not exist in the current context in Guild.cs, line 32, 156, 179, 192, 236 Character.cs, line 1646 Friends - I can only find code for LOTF source. As is, friends will randomly disappear off the friend list. I think it's a problem packing or unpacking the list. ...
[Help] how do i Delete the Auto-Restart system
02/23/2009 - CO2 PServer - Discussions / Questions - 8 Replies
how do i delete the auto restart system??? i really dont like it, so if u can help me plx say...
[Request]Auto Restart Server
08/31/2008 - CO2 PServer - Discussions / Questions - 9 Replies
Can anyone/somesone post a tutorial how to restart your server for about 15 or 10 min or higher. using LOFT source. thanks
HOW DO I DELETE AUTO RESTART
08/21/2008 - CO2 Main - Discussions / Questions - 7 Replies
how do i delete auto restarter?



All times are GMT +1. The time now is 19:47.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2018 elitepvpers All Rights Reserved.