S
S
Sergey Karmanov2018-12-26 19:41:26
linux
Sergey Karmanov, 2018-12-26 19:41:26

How to start a program for the new year in Linux?

I use C# language (console net.core app)
I'm trying to make the program hang on debian and wait for 01.012019 00:00 after that to execute the function.
I don't know how to implement it, pls help.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vitaliy Orlov, 2018-12-26
@serega404

add to cron
minute hour day month day-of-week <command>
or in C# create a timer and check the current date every second, something like this

using System;
using System.Timers;

public class Demo {
   private static Timer timer;

   public static void Main() {
      timer = new System.Timers.Timer();
      timer.Interval = 1000;

      timer.Elapsed += OnTimedEvent;
      timer.AutoReset = true;
      timer.Enabled = true;

      Console.WriteLine("Press the Enter key to exit anytime... ");
      Console.ReadLine();
   }

   private static void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e) {
      Console.WriteLine("Raised: {0}", e.SignalTime);
   }
}

N
Nick V, 2018-12-26
@half-life

Might come in handy
5c23b9b49764e667528085.jpeg

S
Sergey Utkin, 2018-12-26
@DerNitro

at -f run.sh 00:00 january 1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question