schedule next run part 4
This commit is contained in:
parent
d5891cbdd8
commit
d4a86547d1
1 changed files with 32 additions and 28 deletions
12
broker.ts
12
broker.ts
|
@ -17,7 +17,9 @@ const transporter = nodemailer.createTransport({
|
||||||
secure: false // MailHog needs no encryption
|
secure: false // MailHog needs no encryption
|
||||||
});
|
});
|
||||||
|
|
||||||
exec('iching divine', (error, stdout, stderr) => {
|
function executeCommand(): void {
|
||||||
|
|
||||||
|
exec('iching divine', (error, stdout, stderr) => {
|
||||||
|
|
||||||
console.log(`Begin`);
|
console.log(`Begin`);
|
||||||
|
|
||||||
|
@ -52,7 +54,8 @@ exec('iching divine', (error, stdout, stderr) => {
|
||||||
|
|
||||||
// Starte das Scheduling
|
// Starte das Scheduling
|
||||||
scheduleNextRun(nextRunDate);
|
scheduleNextRun(nextRunDate);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Funktion, um die Konfiguration zu laden
|
// Funktion, um die Konfiguration zu laden
|
||||||
function loadConfig(): Config {
|
function loadConfig(): Config {
|
||||||
|
@ -110,7 +113,7 @@ function calculateNextRunDate(daysInterval: number, timeOfDay: string): Date {
|
||||||
|
|
||||||
return currentDate;*/
|
return currentDate;*/
|
||||||
|
|
||||||
currentDate.setMinutes(currentDate.getMinutes() + 2); //TODO: JUST FOR DEBUGGING!!!
|
currentDate.setMinutes(currentDate.getMinutes() + 1); //TODO: JUST FOR DEBUGGING!!!
|
||||||
|
|
||||||
return currentDate;
|
return currentDate;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +127,8 @@ function scheduleNextRun(nextRunDate: Date) {
|
||||||
// Hier wird der Prozess ausgeführt
|
// Hier wird der Prozess ausgeführt
|
||||||
console.log('Prozess wird ausgeführt!');
|
console.log('Prozess wird ausgeführt!');
|
||||||
|
|
||||||
exec('iching divine'); //TODO: ÜBERPRÜFEN!!!
|
//exec('iching divine'); //TODO: ÜBERPRÜFEN!!!
|
||||||
|
executeCommand();
|
||||||
|
|
||||||
// Berechne das nächste Ausführungsdatum und plane es erneut
|
// Berechne das nächste Ausführungsdatum und plane es erneut
|
||||||
const newNextRunDate = calculateNextRunDate(config.daysInterval, config.timeOfDay);
|
const newNextRunDate = calculateNextRunDate(config.daysInterval, config.timeOfDay);
|
||||||
|
|
Loading…
Reference in a new issue