How to trigger an event at 03:00 every night?

How is this done best? I want the application running on the server to fire the event every night at 03:00.

+3
source share
12 answers

Use Windows Task Scheduler

+23
source

( ), , (, 1 3600 ). , , (03:00). , ( 10 ). , , .

(86 400 1 - ), , .

+3

1 , , , 3:00.

+1

.

, Timer, 3:00 , "".

, , Windows. , 24/7, 3:00.


Edit:

( ), . API (ITask) (ITaskScheduler).

, , XP Embedded, , , . , .

+1

, , , , , .

System.Timers.Timer, Interval DateTime.Now 3:00.

+1

, , 60 ... , :

Dim Timer As System.Timers.Timer

Protected Overrides Sub OnStart(ByVal args() As String)
    Timer = New System.Timers.Timer(60000)
    AddHandler Timer.Elapsed, AddressOf timer_Elapsed
    Timer.Start()
End Sub

Protected Overrides Sub OnStop()
    Timer2.Stop()
End Sub

Private Sub timer_Elapsed(ByVal pSender As Object, ByVal pargs As System.Timers.ElapsedEventArgs)
    'Ensure the tick happens in the middle of the minute
    If DateTime.Now.Second < 25 Then
        Timer.Interval = 65000
    ElseIf DateTime.Now.Second > 35 Then
        Timer.Interval = 55000
    ElseIf DateTime.Now.Second >= 25 And DateTime.Now.Second <= 35 Then
        Timer.Interval = 60000
    End If

    'Logic goes here
 End Sub

, , , . . , , , . , , , . , md5sum.

+1

, CruiseControl.NET . , , , / , . , , , / . /, , , , .

, , . , , / , 30 , . :)

+1

Windows ( klausbyskov) SQL Server.

EDIT:

, , , Windows, 10 - .

0

, .

cron, Linux/Unix/Mac OS X, Windows launchd Mac OS X.

, , , 03:00, .

0

Windows # . , , , , ( ).

0

System.Threading.Timer.

I am creating a thread in an ASP.NET application to perform scheduled tasks.

0
source

Can I run the program through the command line? If so, create a file foo.bat and call the command line of the program (very simple).

Then use the Task Scheduler to run the .bat file at 3 p.m. daily.

0
source

Source: https://habr.com/ru/post/1725073/


All Articles