Exemplo n.º 1
0
 protected override void OnStart(string[] args)
 {
     Logger.log("Service Started at " + DateTime.Now);
     _dailyTimer.Enabled  = true;
     _dailyTimer.Interval = _scheduleTime.Subtract(DateTime.Now).TotalSeconds * 1000;
     _dailyTimer.Elapsed += new System.Timers.ElapsedEventHandler(DailyBackup);
     DailyBackupProcessor.InstantFullBackup();
 }
Exemplo n.º 2
0
 private void DailyBackup(object sender, ElapsedEventArgs e)
 {
     Logger.log("Timer fired at " + DateTime.Now);
     if (_dailyTimer.Interval != 24 * 60 * 60 * 1000)
     {
         _dailyTimer.Interval = 24 * 60 * 60 * 1000;
     }
     if (Convert.ToInt32(_MonthlyBackupDate) == DateTime.Now.Day)
     {
         DailyBackupProcessor.CreateFullBackup(Convert.ToInt32(DateTime.Now.Month));
         Logger.log("Create full backup");
     }
     else
     {
         DailyBackupProcessor.CreateIncrementalBackup(Convert.ToInt32(DateTime.Now.Month));
         Logger.log("Create increamental backup");
     }
 }