mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-22 17:22:58 +01:00
🔨 Add auto clean cron
This commit is contained in:
parent
8209459648
commit
22e9f4f912
@ -60,11 +60,17 @@ function updatetNextDate() {
|
|||||||
class CronContainer {
|
class CronContainer {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.cronJob = null;
|
this.cronJob = null;
|
||||||
|
this.cronClean = null
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
let settings = settingsTools.getSettings();
|
let settings = settingsTools.getSettings();
|
||||||
let cronStr = "";
|
let cronStr = "";
|
||||||
|
if (this.cronClean == null) {
|
||||||
|
console.log("Starting auto clean cron...")
|
||||||
|
this.cronClean = new CronJob('0 1 * * *', this._clean, null, false, Intl.DateTimeFormat().resolvedOptions().timeZone);
|
||||||
|
this.cronClean.start();
|
||||||
|
}
|
||||||
if (this.cronJob != null) {
|
if (this.cronJob != null) {
|
||||||
console.log("Stoping Cron...")
|
console.log("Stoping Cron...")
|
||||||
this.cronJob.stop();
|
this.cronJob.stop();
|
||||||
@ -134,8 +140,15 @@ class CronContainer {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
clean() {
|
_clean() {
|
||||||
|
let autoCleanCloud = settingsTools.getSettings().auto_clean_backup;
|
||||||
|
if (autoCleanCloud != null && autoCleanCloud == "true") {
|
||||||
|
this.clean().catch();
|
||||||
|
}
|
||||||
|
let autoCleanlocal = settingsTools.getSettings().auto_clean_local;
|
||||||
|
if (autoCleanlocal != null && autoCleanlocal == "true") {
|
||||||
|
hassioApiTools.clean();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user