Answer the question
In order to leave comments, you need to log in
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
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);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question