Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 03:30

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

Advertisement



corn to optimize and repair

Discussion on corn to optimize and repair within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
BS Support's Avatar
 
elite*gold: 0
Join Date: May 2007
Posts: 27
Received Thanks: 10
corn to optimize and repair

hello

how make corn to corn to optimize and repair tables every day for more good server without sql problems

???
BS Support is offline  
Old 11/10/2008, 15:35   #2
 
taguro's Avatar
 
elite*gold: 0
Join Date: Jun 2007
Posts: 387
Received Thanks: 64
Quote:
Originally Posted by BS Support View Post
hello

how make corn to corn to optimize and repair tables every day for more good server without sql problems

???
I believe you meant cron jobs, and since this was such an awesome question, and people every where can benefit from the information, I will provide help =)

First, everyone should be aware of what Cron is. Cron is the name of program that enables unix users to execute commands or scripts (groups of commands) automatically at a specified time/date. It is normally used for sys admin commands, like makewhatis, which builds a search database for the man -k command, or for running a backup script,
but can be used for anything. A common use for it today is connecting to
the internet and downloading your email. The unix version of Cron was written by Paul Vixie. What you'll find below is kind of a C# version of this.

Now, the specific cron you are refering to is known as the Cron scheduler and is implemented in a single class, CronService.Cron (CronService is the namespace I thought up for this quick little tutorial, but you may want to change this into the default namespace for your Cron application).

You can start an instance of this class using the start() method, which simply starts the scheduler and never returns. For instance, you can link the code below with the Cron class to create a regular Windows executable (for use in Windows' Startup Programs folder, for example):

Code:
using System;

namespace CronService
{
    class CronMain
    {
        [STAThread]
        static void Main(string[] args)
        {
            Cron cron = new Cron ();
            cron.start ();
        }
    }
}
The Cron Service is mainly used to create a Windows Service, and learning to do that is beyond the scope of this answer, so I'll provide you with a link on how to do that .

There is only one small issue with using this service: the OnStart method that you will implement here, is expected to return after 20 seconds or so, so you will have to start the perpetually running scheduler in a separate thread.

The example below provides you with a very stripped down version of doing just that. Please use this code only as a hint when creating your own service.

Code:
using System.Threading;

namespace CronService
{
    public class CronService : System.ServiceProcess.ServiceBase
    {
        private Cron cron;
        private Thread thr;

        public RecoveryService()
        {
            cron = new Cron ();
            thr = new Thread ( new ThreadStart (cron.start));
            thr.Name = "cron";
        }

        protected override void OnStart(string[] args)
        {
            thr.Start ();
        }
 
        protected override void OnStop()
        {
            thr.Abort();
        }
    }
}
Usage:
Quote:
# DoThis every hour
0 * * * * C:\Program\ Files\MyProg\DoThis.exe arg1 arg2
# DoThat -- well, you figure out when :-)
8-9/2 12,13,14-18 * * * C:\Program\ Files\MyProg\DoThat.exe
Hope this helps ya.
taguro is offline  
Reply


Similar Threads Similar Threads
MFT Repair
11/25/2005 - Technical Support - 8 Replies
Mein MFT (Master File Table) is zerschossen hat jemand ne ahnung ob und wenn ja wie man den wieder herstellen kann find nur sperliche informationen und meistens steht da nur recover your files und mach das system neu dazu hab ich nicht so viel lust hab nur die eine 250 GB platte und die is bis auf 13 GB rand voll :( Also kennt wer nen tool oder nen tutorial oder guide dazu? oder alternativ nen richtig gutes disk repair bzw. scan repair prog ala chkdsk von windows das verweigert leider...



All times are GMT +2. The time now is 03:30.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.